import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        static long MOD = 2019;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        static long MOD = 2019;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) C solver = new C(); solver new C() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class C {
        static long MOD = 2019;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        }

    } C static long MOD = 2019; MOD 2019 public void solve(int testNumber, Scanner in, PrintWriter out) {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        } solve {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        } long L = in.nextLong(); L in.nextLong() in.nextLong in long R = in.nextLong(); R in.nextLong() in.nextLong in if (L == 0) {
                out.println(0);
                return;
            } L == 0 L 0 {
                out.println(0);
                return;
            } out.println(0) out.println out 0 return; long min = 2019; min 2019 for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            } long i = L; long i = L; i L i < Math.min(L + 9999, R) i Math.min(L + 9999, R) Math.min Math L + 9999 L 9999 R i++ i++ i {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            } {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            } for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= Math.min(L + 9999, R) j Math.min(L + 9999, R) Math.min Math L + 9999 L 9999 R j++ j++ j {
                    min = Math.min(min, (i * j) % MOD);
                } {
                    min = Math.min(min, (i * j) % MOD);
                } min = Math.min(min, (i * j) % MOD) min Math.min(min, (i * j) % MOD) Math.min Math min (i * j) % MOD (i * j) i j MOD out.println(min) out.println out min int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        static long MOD = 2019;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        static long MOD = 2019;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        static long MOD = 2019;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long L = in.nextLong();
            long R = in.nextLong();
            if (L == 0) {
                out.println(0);
                return;
            }

            long min = 2019;
            for (long i = L; i < Math.min(L + 9999, R); i++) {
                for (long j = i + 1; j <= Math.min(L + 9999, R); j++) {
                    min = Math.min(min, (i * j) % MOD);
                }
            }
            out.println(min);
        }

    }
}

