import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long ans = 0;
		long min = Long.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		}
		System.out.println(min);


		//		if (r < 2019) {
		//			ans =  (l * (l + 1)) % 2019;
		//
		//		} else if (r - l >= 2019 ) {
		//			ans = 0;
		//
		//		} else if (l < 2019 && 2019 < r) {
		//
		//
		//		} else {
		//			ans =  (l * (l + 1)) % 2019;
		//		}

		//		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 = sc.nextLong();
		long r = sc.nextLong();
		long ans = 0;
		long min = Long.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		}
		System.out.println(min);


		//		if (r < 2019) {
		//			ans =  (l * (l + 1)) % 2019;
		//
		//		} else if (r - l >= 2019 ) {
		//			ans = 0;
		//
		//		} else if (l < 2019 && 2019 < r) {
		//
		//
		//		} else {
		//			ans =  (l * (l + 1)) % 2019;
		//		}

		//		System.out.println(ans);


	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long ans = 0;
		long min = Long.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		}
		System.out.println(min);


		//		if (r < 2019) {
		//			ans =  (l * (l + 1)) % 2019;
		//
		//		} else if (r - l >= 2019 ) {
		//			ans = 0;
		//
		//		} else if (l < 2019 && 2019 < r) {
		//
		//
		//		} else {
		//			ans =  (l * (l + 1)) % 2019;
		//		}

		//		System.out.println(ans);


	} main {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long ans = 0;
		long min = Long.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		}
		System.out.println(min);


		//		if (r < 2019) {
		//			ans =  (l * (l + 1)) % 2019;
		//
		//		} else if (r - l >= 2019 ) {
		//			ans = 0;
		//
		//		} else if (l < 2019 && 2019 < r) {
		//
		//
		//		} else {
		//			ans =  (l * (l + 1)) % 2019;
		//		}

		//		System.out.println(ans);


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long ans = 0; ans 0 long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		} long i = l; long i = l; i l i < r i r i++ i++ i {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		} {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		} for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			} {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			} long calc = (i * j) % 2019; calc (i * j) % 2019 (i * j) i j 2019 min = Math.min(min, calc) min Math.min(min, calc) Math.min Math min calc if (min == 0) {
					break;
				} min == 0 min 0 {
					break;
				} break; if (min == 0) {
				break;
			} min == 0 min 0 {
				break;
			} break; 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 = sc.nextLong();
		long r = sc.nextLong();
		long ans = 0;
		long min = Long.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		}
		System.out.println(min);


		//		if (r < 2019) {
		//			ans =  (l * (l + 1)) % 2019;
		//
		//		} else if (r - l >= 2019 ) {
		//			ans = 0;
		//
		//		} else if (l < 2019 && 2019 < r) {
		//
		//
		//		} else {
		//			ans =  (l * (l + 1)) % 2019;
		//		}

		//		System.out.println(ans);


	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long ans = 0;
		long min = Long.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		}
		System.out.println(min);


		//		if (r < 2019) {
		//			ans =  (l * (l + 1)) % 2019;
		//
		//		} else if (r - l >= 2019 ) {
		//			ans = 0;
		//
		//		} else if (l < 2019 && 2019 < r) {
		//
		//
		//		} else {
		//			ans =  (l * (l + 1)) % 2019;
		//		}

		//		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 = sc.nextLong();
		long r = sc.nextLong();
		long ans = 0;
		long min = Long.MAX_VALUE;

		for (long i = l; i < r; i++) {
			for (long j = i + 1; j <= r; j++) {
				long calc = (i * j) % 2019;
				min = Math.min(min, calc);
				if (min == 0) {
					break;
				}
			}
			if (min == 0) {
				break;
			}
		}
		System.out.println(min);


		//		if (r < 2019) {
		//			ans =  (l * (l + 1)) % 2019;
		//
		//		} else if (r - l >= 2019 ) {
		//			ans = 0;
		//
		//		} else if (l < 2019 && 2019 < r) {
		//
		//
		//		} else {
		//			ans =  (l * (l + 1)) % 2019;
		//		}

		//		System.out.println(ans);


	}
}