public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		System.out.println(calc(l, r));
	}

	public static long calc(long l, long r) {
		long next2019 = l - l % 2019 + 2019;
		if (l == 0 || r >= next2019) {
			return 0;
		}
		long min = Long.MAX_VALUE;
		for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		}
		return min;
	}
} public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		System.out.println(calc(l, r));
	}

	public static long calc(long l, long r) {
		long next2019 = l - l % 2019 + 2019;
		if (l == 0 || r >= next2019) {
			return 0;
		}
		long min = Long.MAX_VALUE;
		for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		}
		return min;
	}
} Main public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		System.out.println(calc(l, r));
	} main {
		java.util.Scanner s = new java.util.Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		System.out.println(calc(l, r));
	} java.util.Scanner s = new java.util.Scanner(System.in); s new java.util.Scanner(System.in) long l = s.nextLong(); l s.nextLong() s.nextLong s long r = s.nextLong(); r s.nextLong() s.nextLong s System.out.println(calc(l, r)) System.out.println System.out System System.out calc(l, r) calc l r String[] args args public static long calc(long l, long r) {
		long next2019 = l - l % 2019 + 2019;
		if (l == 0 || r >= next2019) {
			return 0;
		}
		long min = Long.MAX_VALUE;
		for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		}
		return min;
	} calc {
		long next2019 = l - l % 2019 + 2019;
		if (l == 0 || r >= next2019) {
			return 0;
		}
		long min = Long.MAX_VALUE;
		for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		}
		return min;
	} long next2019 = l - l % 2019 + 2019; next2019 l - l % 2019 + 2019 l - l % 2019 l l % 2019 l 2019 2019 if (l == 0 || r >= next2019) {
			return 0;
		} l == 0 || r >= next2019 l == 0 l 0 r >= next2019 r next2019 {
			return 0;
		} return 0; 0 long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		} long i = l; long i = l; i l i < next2019 && i < r i < next2019 i next2019 i < r i r i++ i++ i {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		} {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		} for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j < next2019 && j <= r j < next2019 j next2019 j <= r j r j++ j++ j {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			} {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			} min = Math.min(min, (i * j) % 2019) min Math.min(min, (i * j) % 2019) Math.min Math min (i * j) % 2019 (i * j) i j 2019 if ((i * j) % 2019 == 0) {
					return 0;
				} (i * j) % 2019 == 0 (i * j) % 2019 (i * j) i j 2019 0 {
					return 0;
				} return 0; 0 return min; min long l l long r r public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		System.out.println(calc(l, r));
	}

	public static long calc(long l, long r) {
		long next2019 = l - l % 2019 + 2019;
		if (l == 0 || r >= next2019) {
			return 0;
		}
		long min = Long.MAX_VALUE;
		for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		}
		return min;
	}
} public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		System.out.println(calc(l, r));
	}

	public static long calc(long l, long r) {
		long next2019 = l - l % 2019 + 2019;
		if (l == 0 || r >= next2019) {
			return 0;
		}
		long min = Long.MAX_VALUE;
		for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		}
		return min;
	}
} Main
public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		long l = s.nextLong();
		long r = s.nextLong();
		System.out.println(calc(l, r));
	}

	public static long calc(long l, long r) {
		long next2019 = l - l % 2019 + 2019;
		if (l == 0 || r >= next2019) {
			return 0;
		}
		long min = Long.MAX_VALUE;
		for (long i = l; i < next2019 && i < r; i++) {
			for (long j = i + 1; j < next2019 && j <= r; j++) {
				min = Math.min(min, (i * j) % 2019);
				if ((i * j) % 2019 == 0) {
					return 0;
				}
			}
		}
		return min;
	}
}