import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        long L = scan.nextLong();
        long R = scan.nextLong();
        int ans = Integer.MAX_VALUE;
        long x = 0;
        if (R - L >= 2019) {
            System.out.println(0);
            System.exit(0);
        }
        for (long i = L; i < R; i++) {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        long L = scan.nextLong();
        long R = scan.nextLong();
        int ans = Integer.MAX_VALUE;
        long x = 0;
        if (R - L >= 2019) {
            System.out.println(0);
            System.exit(0);
        }
        for (long i = L; i < R; i++) {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        }
        System.out.println(ans);
    }
} Main public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        long L = scan.nextLong();
        long R = scan.nextLong();
        int ans = Integer.MAX_VALUE;
        long x = 0;
        if (R - L >= 2019) {
            System.out.println(0);
            System.exit(0);
        }
        for (long i = L; i < R; i++) {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        }
        System.out.println(ans);
    } main {
        Scanner scan = new Scanner(System.in);
        long L = scan.nextLong();
        long R = scan.nextLong();
        int ans = Integer.MAX_VALUE;
        long x = 0;
        if (R - L >= 2019) {
            System.out.println(0);
            System.exit(0);
        }
        for (long i = L; i < R; i++) {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long L = scan.nextLong(); L scan.nextLong() scan.nextLong scan long R = scan.nextLong(); R scan.nextLong() scan.nextLong scan int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE long x = 0; x 0 if (R - L >= 2019) {
            System.out.println(0);
            System.exit(0);
        } R - L >= 2019 R - L R L 2019 {
            System.out.println(0);
            System.exit(0);
        } System.out.println(0) System.out.println System.out System System.out 0 System.exit(0) System.exit System 0 for (long i = L; i < R; i++) {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        } long i = L; long i = L; i L i < R i R i++ i++ i {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        } {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        } for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            } long j = L + 1; long j = L + 1; j L + 1 L 1 j <= R j R j++ j++ j {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            } {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            } int m = (int) ((i * j) % 2019); m (int) ((i * j) % 2019) (i * j) i j 2019 ans = Math.min(ans, m) ans Math.min(ans, m) Math.min Math ans m System.out.println(ans) System.out.println System.out System System.out ans final String[] args args
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        long L = scan.nextLong();
        long R = scan.nextLong();
        int ans = Integer.MAX_VALUE;
        long x = 0;
        if (R - L >= 2019) {
            System.out.println(0);
            System.exit(0);
        }
        for (long i = L; i < R; i++) {
            for (long j = L + 1; j <= R; j++) {
                int m = (int) ((i * j) % 2019);
                ans = Math.min(ans, m);
            }
        }
        System.out.println(ans);
    }
}