import java.util.Scanner;
 
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
        int r = sc.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        a:for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                if(i*j % 2019 < remain)
                    remain = i*j % 2019;
                if(remain == 0)
                    break a;
            }
        }
		System.out.println(remain);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
        int r = sc.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        a:for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                if(i*j % 2019 < remain)
                    remain = i*j % 2019;
                if(remain == 0)
                    break a;
            }
        }
		System.out.println(remain);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
        int r = sc.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        a:for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                if(i*j % 2019 < remain)
                    remain = i*j % 2019;
                if(remain == 0)
                    break a;
            }
        }
		System.out.println(remain);
	} main {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
        int r = sc.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        a:for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                if(i*j % 2019 < remain)
                    remain = i*j % 2019;
                if(remain == 0)
                    break a;
            }
        }
		System.out.println(remain);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc long remain = (long)(2 * Math.pow(10,9)) * 2; remain (long)(2 * Math.pow(10,9)) * 2 (long)(2 * Math.pow(10,9)) 2 Math.pow(10,9) Math.pow Math 10 9 2 System.out.println(remain) System.out.println System.out System System.out remain String[] args args
import java.util.Scanner;
 
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
        int r = sc.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        a:for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                if(i*j % 2019 < remain)
                    remain = i*j % 2019;
                if(remain == 0)
                    break a;
            }
        }
		System.out.println(remain);
	}
}