import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Long.MAX_VALUE;
        if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        }


        System.out.println(min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Long.MAX_VALUE;
        if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        }


        System.out.println(min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Long.MAX_VALUE;
        if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        }


        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Long.MAX_VALUE;
        if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        }


        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        } r - l > 2019 r - l r l 2019 {
            min = 0;
        } min = 0 min 0 {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        } System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Long.MAX_VALUE;
        if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        }


        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Long.MAX_VALUE;
        if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        }


        System.out.println(min);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Long.MAX_VALUE;
        if (r - l > 2019) {
            min = 0;
        } else {
            flag:
            for (long i = l; i < r; i++) {
                for (long j = l + 1; j <= r; j++) {
                    min = Math.min(min, (i * j) % 2019);
                    if (min == 0) break flag;
                }
            }
        }


        System.out.println(min);
    }
}