import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();

		if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			}
			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);
		long L = sc.nextLong();
		long R = sc.nextLong();

		if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						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();

		if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			}
			System.out.println(ans);
		}
	} main {

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();

		if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						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 if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			}
			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 = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			}
			System.out.println(ans);
		} long ans = 2019; ans 2019 for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			} long i=L; long i=L; i L i<=R i R i++ i++ i {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			} {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			} for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				} long j=i+1; long j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				} {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				} if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					} i*j % 2019 < ans i*j % 2019 i*j i j 2019 ans {
						ans = i*j % 2019;
					} ans = i*j % 2019 ans i*j % 2019 i*j i j 2019 if(ans == 0) {
						System.out.println(0);
						return;
					} ans == 0 ans 0 {
						System.out.println(0);
						return;
					} System.out.println(0) System.out.println System.out System System.out 0 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();

		if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						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();

		if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			}
			System.out.println(ans);
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();

		if(R-L >= 2019) {
			System.out.println(0);
		}else {
			long ans = 2019;
			for(long i=L;i<=R;i++) {
				for(long j=i+1;j<=R;j++) {
					if(i*j % 2019 < ans) {
						ans = i*j % 2019;
					}

					if(ans == 0) {
						System.out.println(0);
						return;
					}
				}
			}
			System.out.println(ans);
		}
	}

}
