import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long l = Long.parseLong(str[0]);
		long r = Long.parseLong(str[1]);

		if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long l = Long.parseLong(str[0]);
		long r = Long.parseLong(str[1]);

		if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long l = Long.parseLong(str[0]);
		long r = Long.parseLong(str[1]);

		if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long l = Long.parseLong(str[0]);
		long r = Long.parseLong(str[1]);

		if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " long l = Long.parseLong(str[0]); l Long.parseLong(str[0]) Long.parseLong Long str[0] str 0 long r = Long.parseLong(str[1]); r Long.parseLong(str[1]) Long.parseLong Long str[1] str 1 if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		} r - l >= 2019 r - l r l 2019 {
			System.out.println("0");
		} System.out.println("0") System.out.println System.out System System.out "0" {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		} long ans = 2018; ans 2018 for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			} long i = l; long i = l; i l i < r i r i++ i++ i {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			} {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			} for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
					ans = Math.min(ans, (i * j) % 2019);
				} {
					ans = Math.min(ans, (i * j) % 2019);
				} ans = Math.min(ans, (i * j) % 2019) ans 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 String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long l = Long.parseLong(str[0]);
		long r = Long.parseLong(str[1]);

		if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		}
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long l = Long.parseLong(str[0]);
		long r = Long.parseLong(str[1]);

		if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long l = Long.parseLong(str[0]);
		long r = Long.parseLong(str[1]);

		if (r - l >= 2019) {
			System.out.println("0");
		} else {
			long ans = 2018;
			for (long i = l; i < r; i++) {
				for (long j = i + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			System.out.println(ans);
		}
	}
}