import java.util.Scanner;

public class Main {
	final static long mod = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	final static long mod = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	}
} Main final static long mod = 2019; mod 2019 public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	} main {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextLong(); L sc.nextLong() sc.nextLong sc long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc sc.close() sc.close sc if(L / mod != R / mod) { System.out.println(0); return; } L / mod != R / mod L / mod L mod R / mod R mod { System.out.println(0); return; } System.out.println(0) System.out.println System.out System System.out 0 return; 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; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		} 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; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		} {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		} for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			} {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			} long r = (i * j) % mod; r (i * j) % mod (i * j) i j mod min = Math.min(min, r) min Math.min(min, r) Math.min Math min r System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
	final static long mod = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	}
} public class Main {
	final static long mod = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	}
} Main
import java.util.Scanner;

public class Main {
	final static long mod = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	}
}
