import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
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);
        RemainderMinimization2019 solver = new RemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class RemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        }

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

    static class RemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        }

    }
} 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);
        RemainderMinimization2019 solver = new RemainderMinimization2019();
        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);
        RemainderMinimization2019 solver = new RemainderMinimization2019();
        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) RemainderMinimization2019 solver = new RemainderMinimization2019(); solver new RemainderMinimization2019() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class RemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        }

    } RemainderMinimization2019 public void solve(int testNumber, Scanner in, PrintWriter out) {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        } solve {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        } HashSet<Long> set = new HashSet<>(); set new HashSet<>() long l = in.nextLong(); l in.nextLong() in.nextLong in long r = in.nextLong(); r in.nextLong() in.nextLong in long[] mods = new long[2019]; mods new long[2019] 2019 for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            } long i = l; long i = l; i l i <= r i r i++ i++ i {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            } {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            } mods[(int) (i % 2019)]++ mods[(int) (i % 2019)] mods (int) (i % 2019) i 2019 if (mods[0] > 1) {
                    out.println(0);
                    return;
                } mods[0] > 1 mods[0] mods 0 1 {
                    out.println(0);
                    return;
                } out.println(0) out.println out 0 return; long result = Long.MAX_VALUE; result Long.MAX_VALUE Long Long.MAX_VALUE for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            } int i = 0; int i = 0; i 0 i < 2019 i 2019 i++ i++ i {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            } {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            } if (mods[i] < 1) {
                    continue;
                } mods[i] < 1 mods[i] mods i 1 {
                    continue;
                } continue; for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                } int j = 0; int j = 0; j 0 j < 2019 j 2019 j++ j++ j {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                } {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                } if (mods[j] < 1) {
                        continue;
                    } mods[j] < 1 mods[j] mods j 1 {
                        continue;
                    } continue; if (i == j && mods[j] < 2) {
                        continue;
                    } i == j && mods[j] < 2 i == j i j mods[j] < 2 mods[j] mods j 2 {
                        continue;
                    } continue; result = Math.min(result, (i * j) % 2019) result Math.min(result, (i * j) % 2019) Math.min Math result (i * j) % 2019 (i * j) i j 2019 out.println(result) out.println out result 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);
        RemainderMinimization2019 solver = new RemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class RemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        }

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

    static class RemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
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);
        RemainderMinimization2019 solver = new RemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class RemainderMinimization2019 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();
            long[] mods = new long[2019];

            for (long i = l; i <= r; i++) {
                mods[(int) (i % 2019)]++;
                if (mods[0] > 1) {
                    out.println(0);
                    return;
                }
            }

            long result = Long.MAX_VALUE;
            for (int i = 0; i < 2019; i++) {
                if (mods[i] < 1) {
                    continue;
                }
                for (int j = 0; j < 2019; j++) {
                    if (mods[j] < 1) {
                        continue;
                    }

                    if (i == j && mods[j] < 2) {
                        continue;
                    }
                    result = Math.min(result, (i * j) % 2019);
                }
            }

            out.println(result);
        }

    }
}

