import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int l = Integer.valueOf(arr01[0]);
        int r = Integer.valueOf(arr01[1]);

        //        int l = 2022;
        //        int r = l + 2019;
        int mindata = 9999;

        int cnt = 0;
        int num = Math.min(2019, r - l - 1);

        for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        }
        System.out.println(mindata);

    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int l = Integer.valueOf(arr01[0]);
        int r = Integer.valueOf(arr01[1]);

        //        int l = 2022;
        //        int r = l + 2019;
        int mindata = 9999;

        int cnt = 0;
        int num = Math.min(2019, r - l - 1);

        for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        }
        System.out.println(mindata);

    }

} Main public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int l = Integer.valueOf(arr01[0]);
        int r = Integer.valueOf(arr01[1]);

        //        int l = 2022;
        //        int r = l + 2019;
        int mindata = 9999;

        int cnt = 0;
        int num = Math.min(2019, r - l - 1);

        for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        }
        System.out.println(mindata);

    } main {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int l = Integer.valueOf(arr01[0]);
        int r = Integer.valueOf(arr01[1]);

        //        int l = 2022;
        //        int r = l + 2019;
        int mindata = 9999;

        int cnt = 0;
        int num = Math.min(2019, r - l - 1);

        for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        }
        System.out.println(mindata);

    } InputStreamReader is = new InputStreamReader(System.in); is new InputStreamReader(System.in) BufferedReader reader = new BufferedReader(is); reader new BufferedReader(is) List<String> mylist = new ArrayList<>(); mylist new ArrayList<>() String strinput = reader.readLine(); strinput reader.readLine() reader.readLine reader while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        } strinput != null strinput null {

            mylist.add(strinput);
            strinput = reader.readLine();

        } mylist.add(strinput) mylist.add mylist strinput strinput = reader.readLine() strinput reader.readLine() reader.readLine reader String arr01[] = mylist.get(0).split(" "); arr01 mylist.get(0).split(" ") mylist.get(0).split mylist.get(0) mylist.get mylist 0 " " int l = Integer.valueOf(arr01[0]); l Integer.valueOf(arr01[0]) Integer.valueOf Integer arr01[0] arr01 0 int r = Integer.valueOf(arr01[1]); r Integer.valueOf(arr01[1]) Integer.valueOf Integer arr01[1] arr01 1 int mindata = 9999; mindata 9999 int cnt = 0; cnt 0 int num = Math.min(2019, r - l - 1); num Math.min(2019, r - l - 1) Math.min Math 2019 r - l - 1 r - l - 1 r l 1 for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        } int i = l; int i = l; i l i <= r i r i++ i++ i {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        } {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        } for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            } {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            } int amari1 = i % 2019; amari1 i % 2019 i 2019 int amari2 = j % 2019; amari2 j % 2019 j 2019 int amari3 = (amari1 * amari2) % 2019; amari3 (amari1 * amari2) % 2019 (amari1 * amari2) amari1 amari2 2019 mindata = Math.min(mindata, amari3) mindata Math.min(mindata, amari3) Math.min Math mindata amari3 if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                } mindata == 0 mindata 0 {
                    System.out.println(mindata);
                    return;
                } System.out.println(mindata) System.out.println System.out System System.out mindata return; System.out.println(mindata) System.out.println System.out System System.out mindata String[] args args public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int l = Integer.valueOf(arr01[0]);
        int r = Integer.valueOf(arr01[1]);

        //        int l = 2022;
        //        int r = l + 2019;
        int mindata = 9999;

        int cnt = 0;
        int num = Math.min(2019, r - l - 1);

        for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        }
        System.out.println(mindata);

    }

} public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int l = Integer.valueOf(arr01[0]);
        int r = Integer.valueOf(arr01[1]);

        //        int l = 2022;
        //        int r = l + 2019;
        int mindata = 9999;

        int cnt = 0;
        int num = Math.min(2019, r - l - 1);

        for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        }
        System.out.println(mindata);

    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int l = Integer.valueOf(arr01[0]);
        int r = Integer.valueOf(arr01[1]);

        //        int l = 2022;
        //        int r = l + 2019;
        int mindata = 9999;

        int cnt = 0;
        int num = Math.min(2019, r - l - 1);

        for (int i = l; i <= r; i++) {
            for (int j = i + 1; j <= r; j++) {

                int amari1 = i % 2019;
                int amari2 = j % 2019;
                int amari3 = (amari1 * amari2) % 2019;
                mindata = Math.min(mindata, amari3);

                //                System.out.println(i + " " + j + " " + amari3 + " " + mindata);
                if (mindata == 0) {
                    System.out.println(mindata);
                    return;
                }

            }
        }
        System.out.println(mindata);

    }

}
