import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int ans = 2019;

		if (L + 2019 < R) {
			R = L + 2019;
		}

		int i;
		int j;
		int mod;
		for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		}

		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);

		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int ans = 2019;

		if (L + 2019 < R) {
			R = L + 2019;
		}

		int i;
		int j;
		int mod;
		for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		}

		System.out.println(ans);

	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int ans = 2019;

		if (L + 2019 < R) {
			R = L + 2019;
		}

		int i;
		int j;
		int mod;
		for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		}

		System.out.println(ans);

	} main {

		Scanner sc = new Scanner(System.in);

		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int ans = 2019;

		if (L + 2019 < R) {
			R = L + 2019;
		}

		int i;
		int j;
		int mod;
		for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		}

		System.out.println(ans);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int L = Integer.parseInt(sc.next()); L Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int R = Integer.parseInt(sc.next()); R Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = 2019; ans 2019 if (L + 2019 < R) {
			R = L + 2019;
		} L + 2019 < R L + 2019 L 2019 R {
			R = L + 2019;
		} R = L + 2019 R L + 2019 L 2019 int i; i int j; j int mod; mod for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		} i = L; i = L i L i <= R-1 i R-1 R 1 i++ i++ i {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		} {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		} for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			} j = i + 1; j = i + 1 j i + 1 i 1 j <= R j R j++ j++ j {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			} {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			} 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 if (mod < ans) {
					ans = mod;
				} mod < ans mod ans {
					ans = mod;
				} ans = mod ans mod 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) {

		Scanner sc = new Scanner(System.in);

		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int ans = 2019;

		if (L + 2019 < R) {
			R = L + 2019;
		}

		int i;
		int j;
		int mod;
		for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		}

		System.out.println(ans);

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int ans = 2019;

		if (L + 2019 < R) {
			R = L + 2019;
		}

		int i;
		int j;
		int mod;
		for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		}

		System.out.println(ans);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int ans = 2019;

		if (L + 2019 < R) {
			R = L + 2019;
		}

		int i;
		int j;
		int mod;
		for (i = L; i <= R-1; i++) {
			for (j = i + 1; j <= R; j++) {
				mod = ((i % 2019) * (j % 2019)) % 2019;
				if (mod < ans) {
					ans = mod;
				}
			}

		}

		System.out.println(ans);

	}

}
