import 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();
		sc.close();
		long ans = Long.MAX_VALUE;
		for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long ans = Long.MAX_VALUE;
		for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long ans = Long.MAX_VALUE;
		for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long ans = Long.MAX_VALUE;
		for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		}
		System.out.println(ans);
	} 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 sc.close() sc.close sc long ans = Long.MAX_VALUE; ans Long.MAX_VALUE Long Long.MAX_VALUE for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		} long i = L; long i = L; i L i <= R - 1 i R - 1 R 1 i++ i++ i {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		} {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		} for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			} 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);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			} {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			} 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 if (ans == 0) {
					System.out.println(ans);
					return;
				} ans == 0 ans 0 {
					System.out.println(ans);
					return;
				} System.out.println(ans) System.out.println System.out System System.out ans return; 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);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long ans = Long.MAX_VALUE;
		for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long ans = Long.MAX_VALUE;
		for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		}
		System.out.println(ans);
	}
} Main
import 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();
		sc.close();
		long ans = Long.MAX_VALUE;
		for (long i = L; i <= R - 1; i++) {
			for (long j = i + 1; j <= R; j++) {
				ans = Math.min(ans, (i * j) % 2019);
				if (ans == 0) {
					System.out.println(ans);
					return;
				}
			}
		}
		System.out.println(ans);
	}
}
