import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int l = sc.nextInt();
		int r = sc.nextInt();
		int p = 2019;
		
		boolean flag1 = false;
		if(r - l >= 2019)
			flag1 = true;
		
		int L = l % p;
		int R = r % p;
		if(R - L <= 0)
			flag1 = true;
		
		if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		System.out.println(min);
		
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int l = sc.nextInt();
		int r = sc.nextInt();
		int p = 2019;
		
		boolean flag1 = false;
		if(r - l >= 2019)
			flag1 = true;
		
		int L = l % p;
		int R = r % p;
		if(R - L <= 0)
			flag1 = true;
		
		if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		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();
		int p = 2019;
		
		boolean flag1 = false;
		if(r - l >= 2019)
			flag1 = true;
		
		int L = l % p;
		int R = r % p;
		if(R - L <= 0)
			flag1 = true;
		
		if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		System.out.println(min);
		
		}
	} main {
		Scanner sc = new Scanner(System.in);
		
		int l = sc.nextInt();
		int r = sc.nextInt();
		int p = 2019;
		
		boolean flag1 = false;
		if(r - l >= 2019)
			flag1 = true;
		
		int L = l % p;
		int R = r % p;
		if(R - L <= 0)
			flag1 = true;
		
		if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		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 int p = 2019; p 2019 boolean flag1 = false; flag1 false if(r - l >= 2019)
			flag1 = true; r - l >= 2019 r - l r l 2019 flag1 = true flag1 true int L = l % p; L l % p l p int R = r % p; R r % p r p if(R - L <= 0)
			flag1 = true; R - L <= 0 R - L R L 0 flag1 = true flag1 true if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		System.out.println(min);
		
		} flag1 System.out.println(0) System.out.println System.out System System.out 0 {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		System.out.println(min);
		
		} long min = 2019; min 2019 for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			} int i = l ; int i = l ; i l i < r i r i++ i++ i {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			} {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			} for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				} {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				} long lr =((long)i * j) % p; lr ((long)i * j) % p ((long)i * j) (long)i j p min = Math.min(min, lr) min Math.min(min, lr) Math.min Math min lr System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int l = sc.nextInt();
		int r = sc.nextInt();
		int p = 2019;
		
		boolean flag1 = false;
		if(r - l >= 2019)
			flag1 = true;
		
		int L = l % p;
		int R = r % p;
		if(R - L <= 0)
			flag1 = true;
		
		if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		System.out.println(min);
		
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int l = sc.nextInt();
		int r = sc.nextInt();
		int p = 2019;
		
		boolean flag1 = false;
		if(r - l >= 2019)
			flag1 = true;
		
		int L = l % p;
		int R = r % p;
		if(R - L <= 0)
			flag1 = true;
		
		if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		System.out.println(min);
		
		}
	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int l = sc.nextInt();
		int r = sc.nextInt();
		int p = 2019;
		
		boolean flag1 = false;
		if(r - l >= 2019)
			flag1 = true;
		
		int L = l % p;
		int R = r % p;
		if(R - L <= 0)
			flag1 = true;
		
		if(flag1)
			System.out.println(0);
		else {
			long min = 2019;
			for(int i = l ; i < r; i++) {
				for(int j = i + 1; j <= r; j++) {
					long lr =((long)i * j) % p;
					min = Math.min(min, lr);
				}		
			}
		System.out.println(min);
		
		}
	}

}
