import java.util.Scanner;

public class Main {
    static int MODULUS = 2019;

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

        int L = sc.nextInt();
        int R = sc.nextInt();

        System.out.println(solve(L, R));

        sc.close();
    }

    static long solve(int L, int R) {
        long result = Long.MAX_VALUE;
        for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        }

        return result;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static int MODULUS = 2019;

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

        int L = sc.nextInt();
        int R = sc.nextInt();

        System.out.println(solve(L, R));

        sc.close();
    }

    static long solve(int L, int R) {
        long result = Long.MAX_VALUE;
        for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        }

        return result;
    }
} Main static int MODULUS = 2019; MODULUS 2019 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int L = sc.nextInt();
        int R = sc.nextInt();

        System.out.println(solve(L, R));

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int L = sc.nextInt();
        int R = sc.nextInt();

        System.out.println(solve(L, R));

        sc.close();
    } 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 System.out.println(solve(L, R)) System.out.println System.out System System.out solve(L, R) solve L R sc.close() sc.close sc String[] args args static long solve(int L, int R) {
        long result = Long.MAX_VALUE;
        for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        }

        return result;
    } solve {
        long result = Long.MAX_VALUE;
        for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        }

        return result;
    } long result = Long.MAX_VALUE; result Long.MAX_VALUE Long Long.MAX_VALUE for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        } int i = L; int i = L; i L i < R && i - L < MODULUS i < R i R i - L < MODULUS i - L i L MODULUS ++i ++i i {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        } {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        } for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R && j - L < MODULUS j <= R j R j - L < MODULUS j - L j L MODULUS ++j ++j j {
                result = Math.min(result, (long) i * j % MODULUS);
            } {
                result = Math.min(result, (long) i * j % MODULUS);
            } result = Math.min(result, (long) i * j % MODULUS) result Math.min(result, (long) i * j % MODULUS) Math.min Math result (long) i * j % MODULUS (long) i * j (long) i j MODULUS return result; result int L L int R R public class Main {
    static int MODULUS = 2019;

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

        int L = sc.nextInt();
        int R = sc.nextInt();

        System.out.println(solve(L, R));

        sc.close();
    }

    static long solve(int L, int R) {
        long result = Long.MAX_VALUE;
        for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        }

        return result;
    }
} public class Main {
    static int MODULUS = 2019;

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

        int L = sc.nextInt();
        int R = sc.nextInt();

        System.out.println(solve(L, R));

        sc.close();
    }

    static long solve(int L, int R) {
        long result = Long.MAX_VALUE;
        for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        }

        return result;
    }
} Main
import java.util.Scanner;

public class Main {
    static int MODULUS = 2019;

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

        int L = sc.nextInt();
        int R = sc.nextInt();

        System.out.println(solve(L, R));

        sc.close();
    }

    static long solve(int L, int R) {
        long result = Long.MAX_VALUE;
        for (int i = L; i < R && i - L < MODULUS; ++i) {
            for (int j = i + 1; j <= R && j - L < MODULUS; ++j) {
                result = Math.min(result, (long) i * j % MODULUS);
            }
        }

        return result;
    }
}