import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long l = Integer.parseInt(sc.next());
		long r = Integer.parseInt(sc.next());

		long min = Integer.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		}
		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);

		long l = Integer.parseInt(sc.next());
		long r = Integer.parseInt(sc.next());

		long min = Integer.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long l = Integer.parseInt(sc.next());
		long r = Integer.parseInt(sc.next());

		long min = Integer.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
	} main {
		Scanner sc = new Scanner(System.in);

		long l = Integer.parseInt(sc.next());
		long r = Integer.parseInt(sc.next());

		long min = Integer.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = Integer.parseInt(sc.next()); l Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long r = Integer.parseInt(sc.next()); r Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		} long i = l; long i = l; i l i < r i r i++ i++ i {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		} {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		} for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			} {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			} long mod = (i % 2019 * j % 2019) % 2019; mod (i % 2019 * j % 2019) % 2019 (i % 2019 * j % 2019) i % 2019 * j i % 2019 i 2019 j 2019 2019 if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				} mod == 0 mod 0 {
					System.out.println(0);
					System.exit(0);
				} System.out.println(0) System.out.println System.out System System.out 0 System.exit(0) System.exit System 0 if (mod < min) {
					min = mod;
				} mod < min mod min {
					min = mod;
				} min = mod min mod 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);

		long l = Integer.parseInt(sc.next());
		long r = Integer.parseInt(sc.next());

		long min = Integer.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long l = Integer.parseInt(sc.next());
		long r = Integer.parseInt(sc.next());

		long min = Integer.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long l = Integer.parseInt(sc.next());
		long r = Integer.parseInt(sc.next());

		long min = Integer.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long mod = (i % 2019 * j % 2019) % 2019;
				if (mod == 0) {
					System.out.println(0);
					System.exit(0);
				} else if (mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
	}
}