import java.util.Scanner;

public class Main {

    static final int MOD = 2019;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        sc.close();

        int min = l % MOD;
        int max = Math.min((r - l), MOD);
        int ans = MOD;
        for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        }
        System.out.println(ans);
    }

} import java.util.Scanner; Scanner java.util public class Main {

    static final int MOD = 2019;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        sc.close();

        int min = l % MOD;
        int max = Math.min((r - l), MOD);
        int ans = MOD;
        for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        }
        System.out.println(ans);
    }

} Main static final int MOD = 2019; MOD 2019 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        sc.close();

        int min = l % MOD;
        int max = Math.min((r - l), MOD);
        int ans = MOD;
        for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        sc.close();

        int min = l % MOD;
        int max = Math.min((r - l), MOD);
        int ans = MOD;
        for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc sc.close() sc.close sc int min = l % MOD; min l % MOD l MOD int max = Math.min((r - l), MOD); max Math.min((r - l), MOD) Math.min Math (r - l) r l MOD int ans = MOD; ans MOD for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        } int i = min; int i = min; i min i <= min + max i min + max min max i++ i++ i {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        } {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        } for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= min + max j min + max min max j++ j++ j {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            } {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            } int tmp = (i * j) % MOD; tmp (i * j) % MOD (i * j) i j MOD if (tmp < ans) {
                    ans = tmp;
                } tmp < ans tmp ans {
                    ans = tmp;
                } ans = tmp ans tmp System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    static final int MOD = 2019;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        sc.close();

        int min = l % MOD;
        int max = Math.min((r - l), MOD);
        int ans = MOD;
        for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        }
        System.out.println(ans);
    }

} public class Main {

    static final int MOD = 2019;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        sc.close();

        int min = l % MOD;
        int max = Math.min((r - l), MOD);
        int ans = MOD;
        for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        }
        System.out.println(ans);
    }

} Main
import java.util.Scanner;

public class Main {

    static final int MOD = 2019;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        sc.close();

        int min = l % MOD;
        int max = Math.min((r - l), MOD);
        int ans = MOD;
        for (int i = min; i <= min + max; i++) {
            for (int j = i + 1; j <= min + max; j++) {
                int tmp = (i * j) % MOD;
                if (tmp < ans) {
                    ans = tmp;
                }
            }
        }
        System.out.println(ans);
    }

}
