import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		sc.close();

		int mod = 2019;
		if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		sc.close();

		int mod = 2019;
		if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		}
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		sc.close();

		int mod = 2019;
		if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		sc.close();

		int mod = 2019;
		if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		}
	} 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 sc.close() sc.close sc int mod = 2019; mod 2019 if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		} l / mod < r / mod l / mod l mod r / mod r mod {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		} int ml = l % mod; ml l % mod l mod int mr = r % mod; mr r % mod r mod int ans = mod; ans mod for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			} int i = ml; int i = ml; i ml i < mr i mr i++ i++ i {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			} {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			} for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= mr j mr j++ j++ j {
					ans = Math.min(ans, i * j % mod);
				} {
					ans = Math.min(ans, i * j % mod);
				} ans = Math.min(ans, i * j % mod) ans Math.min(ans, i * j % mod) Math.min Math ans i * j % mod i * j i j mod 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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		sc.close();

		int mod = 2019;
		if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		}
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		sc.close();

		int mod = 2019;
		if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		sc.close();

		int mod = 2019;
		if (l / mod < r / mod) {
			System.out.println(0);
		} else {
			int ml = l % mod;
			int mr = r % mod;
			int ans = mod;
			for (int i = ml; i < mr; i++) {
				for (int j = i + 1; j <= mr; j++) {
					ans = Math.min(ans, i * j % mod);
				}
			}
			System.out.println(ans);
		}
	}
}
