import java.util.Scanner;

public class Main {

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

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

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

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc long L = sc.nextLong(); L sc.nextLong() sc.nextLong sc long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		} L - R > 2019 L - R L R 2019 {
			min = 0;
		} min = 0 min 0 {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		} for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			} long i = R; long i = R; i R i < L i L i++ i++ i {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			} {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			} for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				} long j = L; long j = L; j L j > i j i j-- j-- j {
					min = Math.min(i* j % 2019, min);
				} {
					min = Math.min(i* j % 2019, min);
				} min = Math.min(i* j % 2019, min) min Math.min(i* j % 2019, min) Math.min Math i* j % 2019 i* j i j 2019 min System.out.println(min) System.out.println System.out System System.out min sc.close() sc.close sc String[] args args public class Main {

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

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	}

} public class Main {

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

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {

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

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	}

}
