import java.util.Scanner;

public class Main {

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

		int l = sc.nextInt();
		int r = sc.nextInt();

		long min = 9999;

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

		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);

		int l = sc.nextInt();
		int r = sc.nextInt();

		long min = 9999;

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

		System.out.println(min);

	}

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

		int l = sc.nextInt();
		int r = sc.nextInt();

		long min = 9999;

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

		System.out.println(min);

	} main {
		Scanner sc = new Scanner(System.in);

		int l = sc.nextInt();
		int r = sc.nextInt();

		long min = 9999;

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

		System.out.println(min);

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

		int l = sc.nextInt();
		int r = sc.nextInt();

		long min = 9999;

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

		System.out.println(min);

	}

} public class Main {

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

		int l = sc.nextInt();
		int r = sc.nextInt();

		long min = 9999;

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

		System.out.println(min);

	}

} Main
import java.util.Scanner;

public class Main {

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

		int l = sc.nextInt();
		int r = sc.nextInt();

		long min = 9999;

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

		System.out.println(min);

	}

}
