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 min = 2019;

		for(int i=0; i<2019; i++){
			long x = l+i;
			for(int j=i+1; j<2019; j++){
				long y = l+j;
				if(x>r || y>r) break;
				min = Math.min(min, (x*y)%2019);
			}
		}
		System.out.println(min);

	}
} 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 min = 2019;

		for(int i=0; i<2019; i++){
			long x = l+i;
			for(int j=i+1; j<2019; j++){
				long y = l+j;
				if(x>r || y>r) break;
				min = Math.min(min, (x*y)%2019);
			}
		}
		System.out.println(min);

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		long min = 2019;

		for(int i=0; i<2019; i++){
			long x = l+i;
			for(int j=i+1; j<2019; j++){
				long y = l+j;
				if(x>r || y>r) break;
				min = Math.min(min, (x*y)%2019);
			}
		}
		System.out.println(min);

	} main {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		long min = 2019;

		for(int i=0; i<2019; i++){
			long x = l+i;
			for(int j=i+1; j<2019; j++){
				long y = l+j;
				if(x>r || y>r) break;
				min = Math.min(min, (x*y)%2019);
			}
		}
		System.out.println(min);

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

		for(int i=0; i<2019; i++){
			long x = l+i;
			for(int j=i+1; j<2019; j++){
				long y = l+j;
				if(x>r || y>r) break;
				min = Math.min(min, (x*y)%2019);
			}
		}
		System.out.println(min);

	}
}
