import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L, R, ans;
		L = sc.nextLong();
		R = sc.nextLong();
		sc.close();
		R = Math.min(R, L + 4038);
		ans = 2100;
		for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L, R, ans;
		L = sc.nextLong();
		R = sc.nextLong();
		sc.close();
		R = Math.min(R, L + 4038);
		ans = 2100;
		for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L, R, ans;
		L = sc.nextLong();
		R = sc.nextLong();
		sc.close();
		R = Math.min(R, L + 4038);
		ans = 2100;
		for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		long L, R, ans;
		L = sc.nextLong();
		R = sc.nextLong();
		sc.close();
		R = Math.min(R, L + 4038);
		ans = 2100;
		for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L L R R ans; ans L = sc.nextLong() L sc.nextLong() sc.nextLong sc R = sc.nextLong() R sc.nextLong() sc.nextLong sc sc.close() sc.close sc R = Math.min(R, L + 4038) R Math.min(R, L + 4038) Math.min Math R L + 4038 L 4038 ans = 2100 ans 2100 for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		} long i = L; long i = L; i L i < R i R i++ i++ i {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		} {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		} for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			} {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			} long a = (i * j) % 2019; a (i * j) % 2019 (i * j) i j 2019 if (ans > a) {
					ans = a;
				} ans > a ans a {
					ans = a;
				} ans = a ans a System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L, R, ans;
		L = sc.nextLong();
		R = sc.nextLong();
		sc.close();
		R = Math.min(R, L + 4038);
		ans = 2100;
		for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L, R, ans;
		L = sc.nextLong();
		R = sc.nextLong();
		sc.close();
		R = Math.min(R, L + 4038);
		ans = 2100;
		for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L, R, ans;
		L = sc.nextLong();
		R = sc.nextLong();
		sc.close();
		R = Math.min(R, L + 4038);
		ans = 2100;
		for (long i = L; i < R; i++) {
			for (long j = i + 1; j <= R; j++) {
				long a = (i * j) % 2019;
				if (ans > a) {
					ans = a;
				}
			}
		}
		System.out.println(ans);
	}
}
