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();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	}
} 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();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	} main {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	} 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 int mod = 0; mod 0 int minMod = Integer.MAX_VALUE; minMod Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		} int i = L; int i = L; i L i < R i R i++ i++ i {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		} {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		} for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			} {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			} mod = (i % 2019) * (j % 2019) % 2019 mod (i % 2019) * (j % 2019) % 2019 (i % 2019) * (j % 2019) (i % 2019) i 2019 (j % 2019) j 2019 2019 minMod = Math.min(minMod, mod) minMod Math.min(minMod, mod) Math.min Math minMod mod if ((j - i) % 2019 == 0) break; (j - i) % 2019 == 0 (j - i) % 2019 (j - i) j i 2019 0 break; if (i % 2019 == 0) break; i % 2019 == 0 i % 2019 i 2019 0 break; System.out.println(minMod) System.out.println System.out System System.out minMod 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();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	}
} 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();
		int mod = 0;
		int minMod = Integer.MAX_VALUE;

		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
				mod = (i % 2019) * (j % 2019) % 2019;
				minMod = Math.min(minMod, mod);
				if ((j - i) % 2019 == 0) break;
			}
			if (i % 2019 == 0) break;
		}

		System.out.println(minMod);
	}
}
