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);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        }

    }
}
 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);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        }

    }
} 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);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        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);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        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) CRemainderMinimization2019 solver = new CRemainderMinimization2019(); solver new CRemainderMinimization2019() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class CRemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        }

    } CRemainderMinimization2019 public void solve(int testNumber, Scanner in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        } solve {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        } long l = in.nextInt(); l in.nextInt() in.nextInt in long r = in.nextInt(); r in.nextInt() in.nextInt in long res = Long.MAX_VALUE; res Long.MAX_VALUE Long Long.MAX_VALUE for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            } long i = l; long i = l; i l i <= r && i <= l + 2019 i <= r i r i <= l + 2019 i l + 2019 l 2019 i++ i++ i {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            } {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            } for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r && j <= i + 2020 j <= r j r j <= i + 2020 j i + 2020 i 2020 j++ j++ j {
                    res = Math.min(res, (i * j) % 2019);
                } {
                    res = Math.min(res, (i * j) % 2019);
                } res = Math.min(res, (i * j) % 2019) res Math.min(res, (i * j) % 2019) Math.min Math res (i * j) % 2019 (i * j) i j 2019 out.println(res) out.println out res 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);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        }

    }
} 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);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        }

    }
} 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);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long res = Long.MAX_VALUE;
            for (long i = l; i <= r && i <= l + 2019; i++) {
                for (long j = i + 1; j <= r && j <= i + 2020; j++) {
                    res = Math.min(res, (i * j) % 2019);
                }
            }
            out.println(res);
        }

    }
}

