import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}
 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.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.InputStream; InputStream java.io public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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;
        InputReader in = new InputReader(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 InputReader in = new InputReader(inputStream); in new InputReader(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, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        }

    } CRemainderMinimization2019 public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        } solve {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        } long l = in.nextLong(); l in.nextLong() in.nextLong in long r = in.nextLong(); r in.nextLong() in.nextLong in long ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE long s = l % 2019; s l % 2019 l 2019 long t = r % 2019; t r % 2019 r 2019 if (t <= s) {
                out.println(0);
                return;
            } t <= s t s {
                out.println(0);
                return;
            } out.println(0) out.println out 0 return; if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            } (r - l) / 2019 >= 1 (r - l) / 2019 (r - l) r l 2019 1 {
                out.println(0);
                return;
            } out.println(0) out.println out 0 return; for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            } long i = s; long i = s; i s i <= t i t i++ i++ i {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            } {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            } for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= t j t j++ j++ j {
                    ans = Math.min(ans, (i * j) % 2019);
                } {
                    ans = Math.min(ans, (i * j) % 2019);
                } ans = Math.min(ans, (i * j) % 2019) ans Math.min(ans, (i * j) % 2019) Math.min Math ans (i * j) % 2019 (i * j) i j 2019 out.println(ans) out.println out ans int testNumber testNumber InputReader in in PrintWriter out out static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    } InputReader public BufferedReader reader; reader public StringTokenizer tokenizer; tokenizer public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } InputReader {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(stream), 32768) reader new BufferedReader(new InputStreamReader(stream), 32768) tokenizer = null tokenizer null InputStream stream stream public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long ans = Integer.MAX_VALUE;
            long s = l % 2019;
            long t = r % 2019;
            if (t <= s) {
                out.println(0);
                return;
            }
            if ((r - l) / 2019 >= 1) {
                out.println(0);
                return;
            }
            for (long i = s; i <= t; i++) {
                for (long j = i + 1; j <= t; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);


        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

