import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // SOLUTION A
//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int a = scanner.nextInt();
//        int b = scanner.nextInt();
//        int answer = solutionA(n, a, b);
//        System.out.println(answer);
//    }
//
//    public static int solutionA (int n, int a, int b) {
//        if ((n * a) < b) {
//            return (n * a);
//        } else {
//            return b;
//        }
//    }

        // SOLUTION B
        Scanner scanner = new Scanner(System.in);
        long i = scanner.nextLong();
        long j = scanner.nextLong();
        System.out.println(solutionB(i, j));
    }

    // james wuz here lul
    public static long solutionB(long l, long r) {
        if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        // SOLUTION A
//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int a = scanner.nextInt();
//        int b = scanner.nextInt();
//        int answer = solutionA(n, a, b);
//        System.out.println(answer);
//    }
//
//    public static int solutionA (int n, int a, int b) {
//        if ((n * a) < b) {
//            return (n * a);
//        } else {
//            return b;
//        }
//    }

        // SOLUTION B
        Scanner scanner = new Scanner(System.in);
        long i = scanner.nextLong();
        long j = scanner.nextLong();
        System.out.println(solutionB(i, j));
    }

    // james wuz here lul
    public static long solutionB(long l, long r) {
        if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        }
    }
} Main public static void main(String[] args) {
        // SOLUTION A
//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int a = scanner.nextInt();
//        int b = scanner.nextInt();
//        int answer = solutionA(n, a, b);
//        System.out.println(answer);
//    }
//
//    public static int solutionA (int n, int a, int b) {
//        if ((n * a) < b) {
//            return (n * a);
//        } else {
//            return b;
//        }
//    }

        // SOLUTION B
        Scanner scanner = new Scanner(System.in);
        long i = scanner.nextLong();
        long j = scanner.nextLong();
        System.out.println(solutionB(i, j));
    } main {
        // SOLUTION A
//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int a = scanner.nextInt();
//        int b = scanner.nextInt();
//        int answer = solutionA(n, a, b);
//        System.out.println(answer);
//    }
//
//    public static int solutionA (int n, int a, int b) {
//        if ((n * a) < b) {
//            return (n * a);
//        } else {
//            return b;
//        }
//    }

        // SOLUTION B
        Scanner scanner = new Scanner(System.in);
        long i = scanner.nextLong();
        long j = scanner.nextLong();
        System.out.println(solutionB(i, j));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long i = scanner.nextLong(); i scanner.nextLong() scanner.nextLong scanner long j = scanner.nextLong(); j scanner.nextLong() scanner.nextLong scanner System.out.println(solutionB(i, j)) System.out.println System.out System System.out solutionB(i, j) solutionB i j String[] args args // james wuz here lul
    public static long solutionB(long l, long r) {
        if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        }
    } solutionB {
        if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        }
    } if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        } l + 2019 <= r l + 2019 l 2019 r {
            return 0;
        } return 0; 0 {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        } long min = 2019; min 2019 for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            } long i = l; long i = l; i l i <= r i r i++ i++ i {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            } {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            } for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                } {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                } long x = (i * j) % 2019; x (i * j) % 2019 (i * j) i j 2019 if (x < min) {
                        min = x;
                    } x < min x min {
                        min = x;
                    } min = x min x return min; min long l l long r r public class Main {
    public static void main(String[] args) {
        // SOLUTION A
//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int a = scanner.nextInt();
//        int b = scanner.nextInt();
//        int answer = solutionA(n, a, b);
//        System.out.println(answer);
//    }
//
//    public static int solutionA (int n, int a, int b) {
//        if ((n * a) < b) {
//            return (n * a);
//        } else {
//            return b;
//        }
//    }

        // SOLUTION B
        Scanner scanner = new Scanner(System.in);
        long i = scanner.nextLong();
        long j = scanner.nextLong();
        System.out.println(solutionB(i, j));
    }

    // james wuz here lul
    public static long solutionB(long l, long r) {
        if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        }
    }
} public class Main {
    public static void main(String[] args) {
        // SOLUTION A
//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int a = scanner.nextInt();
//        int b = scanner.nextInt();
//        int answer = solutionA(n, a, b);
//        System.out.println(answer);
//    }
//
//    public static int solutionA (int n, int a, int b) {
//        if ((n * a) < b) {
//            return (n * a);
//        } else {
//            return b;
//        }
//    }

        // SOLUTION B
        Scanner scanner = new Scanner(System.in);
        long i = scanner.nextLong();
        long j = scanner.nextLong();
        System.out.println(solutionB(i, j));
    }

    // james wuz here lul
    public static long solutionB(long l, long r) {
        if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // SOLUTION A
//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int a = scanner.nextInt();
//        int b = scanner.nextInt();
//        int answer = solutionA(n, a, b);
//        System.out.println(answer);
//    }
//
//    public static int solutionA (int n, int a, int b) {
//        if ((n * a) < b) {
//            return (n * a);
//        } else {
//            return b;
//        }
//    }

        // SOLUTION B
        Scanner scanner = new Scanner(System.in);
        long i = scanner.nextLong();
        long j = scanner.nextLong();
        System.out.println(solutionB(i, j));
    }

    // james wuz here lul
    public static long solutionB(long l, long r) {
        if (l + 2019 <= r) {
            return 0;
        } else {
            long min = 2019;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    // this nested for loop is brute forcing it by comparing two integers
                    // ex: 2020, 2025 would look like
                    // i = 2020, j = 2021, 2022, 2023, 2024, 2025
                    // i = 2021, j = 2022, 2023, 2024, 2025
                    // ...
                    // until i = 2025, and j is nothing because 2026 is not less than r (which is 2025)
                    long x = (i * j) % 2019;
                    if (x < min) {
                        min = x;
                    }
                }
            }
            return min;
        }
    }
}
