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 N = R;

		if (R > L + 2019) {
			N = L + 2019;
		}
		int ans = Integer.MAX_VALUE;
		for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} 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 N = R;

		if (R > L + 2019) {
			N = L + 2019;
		}
		int ans = Integer.MAX_VALUE;
		for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		long N = R;

		if (R > L + 2019) {
			N = L + 2019;
		}
		int ans = Integer.MAX_VALUE;
		for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		}
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		long N = R;

		if (R > L + 2019) {
			N = L + 2019;
		}
		int ans = Integer.MAX_VALUE;
		for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		}
		System.out.println(ans);
		sc.close();
	} 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 N = R; N R if (R > L + 2019) {
			N = L + 2019;
		} R > L + 2019 R L + 2019 L 2019 {
			N = L + 2019;
		} N = L + 2019 N L + 2019 L 2019 int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		} long i = L; long i = L; i L i <= N i N i++ i++ i {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		} {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		} for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= N j N j++ j++ j {
				ans = (int) Math.min(ans, i * j % 2019);
			} {
				ans = (int) Math.min(ans, i * j % 2019);
			} ans = (int) Math.min(ans, i * j % 2019) ans (int) Math.min(ans, i * j % 2019) Math.min Math ans i * j % 2019 i * j i j 2019 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc 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 N = R;

		if (R > L + 2019) {
			N = L + 2019;
		}
		int ans = Integer.MAX_VALUE;
		for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		long N = R;

		if (R > L + 2019) {
			N = L + 2019;
		}
		int ans = Integer.MAX_VALUE;
		for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} 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 N = R;

		if (R > L + 2019) {
			N = L + 2019;
		}
		int ans = Integer.MAX_VALUE;
		for (long i = L; i <= N; i++) {
			for (long j = i + 1; j <= N; j++) {
				ans = (int) Math.min(ans, i * j % 2019);
			}
		}
		System.out.println(ans);
		sc.close();
	}
}