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();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    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();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    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();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    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();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    result = Math.min(result, i * j % 2019);
                }
            }
            out.println(result);
        } solve {
            HashSet<Long> set = new HashSet<>();
            long l = in.nextLong();
            long r = in.nextLong();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    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 if (r - l > 2019) {
                out.println(0);
                return;
            } r - l > 2019 r - l r l 2019 {
                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 (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    result = Math.min(result, i * j % 2019);
                }
            } long i = l; long i = l; i l i < r i r i++ i++ i {
                for (long j = i + 1; j <= r; j++) {
                    result = Math.min(result, i * j % 2019);
                }
            } {
                for (long j = i + 1; j <= r; j++) {
                    result = Math.min(result, i * j % 2019);
                }
            } for (long j = i + 1; j <= r; j++) {
                    result = Math.min(result, i * j % 2019);
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
                    result = Math.min(result, i * j % 2019);
                } {
                    result = Math.min(result, i * j % 2019);
                } 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();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    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();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    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();

            if (r - l > 2019) {
                out.println(0);
                return;
            }
            long result = Long.MAX_VALUE;

            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    result = Math.min(result, i * j % 2019);
                }
            }
            out.println(result);
        }

    }
}

