import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    }

} import java.io.BufferedInputStream; BufferedInputStream java.io import java.io.BufferedOutputStream; BufferedOutputStream 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) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    }

} Main public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    } main {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    } try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        } {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        } BufferedInputStream in = new BufferedInputStream(System.in) BufferedInputStream in = new BufferedInputStream(System.in) new BufferedInputStream(System.in) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) new PrintWriter(new BufferedOutputStream(System.out)) Scanner sc = new Scanner(in); sc new Scanner(in) long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long x = 2019; x 2019 if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            } l == 0 || r / x - (l - 1) / x > 0 l == 0 l 0 r / x - (l - 1) / x > 0 r / x - (l - 1) / x r / x r x (l - 1) / x (l - 1) l 1 x 0 {
                out.println(0);
            } out.println(0) out.println out 0 {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            } long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                } long i = l; long i = l; i l i < r + 1 i r + 1 r 1 i++ i++ i {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                } {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                } for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    } long j = i + 1; long j = i + 1; j i + 1 i 1 j < r + 1 j r + 1 r 1 j++ j++ j {
                        min = Math.min(min, (i * j) % x);
                    } {
                        min = Math.min(min, (i * j) % x);
                    } min = Math.min(min, (i * j) % x) min Math.min(min, (i * j) % x) Math.min Math min (i * j) % x (i * j) i j x out.println(min) out.println out min String[] args args public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    }

} public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    }

} Main
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    }

}
