import java.util.Scanner;

public class Main {

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

		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);

		long minVal = Integer.MAX_VALUE;
		for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		}
		System.out.println(minVal);
	}
} import java.util.Scanner; Scanner java.util public class Main {

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

		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);

		long minVal = Integer.MAX_VALUE;
		for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		}
		System.out.println(minVal);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] line = sc.nextLine().split(" ");

		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);

		long minVal = Integer.MAX_VALUE;
		for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		}
		System.out.println(minVal);
	} main {
		Scanner sc = new Scanner(System.in);
		String[] line = sc.nextLine().split(" ");

		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);

		long minVal = Integer.MAX_VALUE;
		for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		}
		System.out.println(minVal);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int L = Integer.parseInt(line[0]); L Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int R = Integer.parseInt(line[1]); R Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 long minVal = Integer.MAX_VALUE; minVal Integer.MAX_VALUE Integer Integer.MAX_VALUE for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		} long i = L; long i = L; i L i <= R i R i++ i++ i {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		} {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		} for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			} {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			} minVal = Math.min(minVal, (i * j) % 2019) minVal Math.min(minVal, (i * j) % 2019) Math.min Math minVal (i * j) % 2019 (i * j) i j 2019 if (minVal == 0) {
					System.out.println(minVal);
					return;
				} minVal == 0 minVal 0 {
					System.out.println(minVal);
					return;
				} System.out.println(minVal) System.out.println System.out System System.out minVal return; System.out.println(minVal) System.out.println System.out System System.out minVal String[] args args public class Main {

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

		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);

		long minVal = Integer.MAX_VALUE;
		for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		}
		System.out.println(minVal);
	}
} public class Main {

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

		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);

		long minVal = Integer.MAX_VALUE;
		for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		}
		System.out.println(minVal);
	}
} Main
import java.util.Scanner;

public class Main {

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

		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);

		long minVal = Integer.MAX_VALUE;
		for (long i = L; i <= R; i++) {
			for (long j = i + 1; j <= R; j++) {
				minVal = Math.min(minVal, (i * j) % 2019);
				if (minVal == 0) {
					System.out.println(minVal);
					return;
				}
			}
		}
		System.out.println(minVal);
	}
}