import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long L = (long) Integer.parseInt(sc.next());
		Long R = (long) Integer.parseInt(sc.next());
		sc.close();
		long a = L / 2019;
		long b = R / 2019;
		long base = 2019;
		if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long L = (long) Integer.parseInt(sc.next());
		Long R = (long) Integer.parseInt(sc.next());
		sc.close();
		long a = L / 2019;
		long b = R / 2019;
		long base = 2019;
		if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long L = (long) Integer.parseInt(sc.next());
		Long R = (long) Integer.parseInt(sc.next());
		sc.close();
		long a = L / 2019;
		long b = R / 2019;
		long base = 2019;
		if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		Long L = (long) Integer.parseInt(sc.next());
		Long R = (long) Integer.parseInt(sc.next());
		sc.close();
		long a = L / 2019;
		long b = R / 2019;
		long base = 2019;
		if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Long L = (long) Integer.parseInt(sc.next()); L (long) Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Long R = (long) Integer.parseInt(sc.next()); R (long) Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc long a = L / 2019; a L / 2019 L 2019 long b = R / 2019; b R / 2019 R 2019 long base = 2019; base 2019 if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		} a != b a b {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		} for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			} long i = L; long i = L; i L i < R i R i++ i++ i {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			} {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			} for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				} long j = L + 1; long j = L + 1; j L + 1 L 1 j <= R j R j++ j++ j {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				} {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				} long c = i % 2019; c i % 2019 i 2019 long d = j % 2019; d j % 2019 j 2019 long check = c * d; check c * d c d long checkValue = check % 2019; checkValue check % 2019 check 2019 if(checkValue <= base) {
						base = checkValue;
					} checkValue <= base checkValue base {
						base = checkValue;
					} base = checkValue base checkValue System.out.println(base) System.out.println System.out System System.out base String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long L = (long) Integer.parseInt(sc.next());
		Long R = (long) Integer.parseInt(sc.next());
		sc.close();
		long a = L / 2019;
		long b = R / 2019;
		long base = 2019;
		if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long L = (long) Integer.parseInt(sc.next());
		Long R = (long) Integer.parseInt(sc.next());
		sc.close();
		long a = L / 2019;
		long b = R / 2019;
		long base = 2019;
		if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long L = (long) Integer.parseInt(sc.next());
		Long R = (long) Integer.parseInt(sc.next());
		sc.close();
		long a = L / 2019;
		long b = R / 2019;
		long base = 2019;
		if(a != b) {
			System.out.println(0);
		}else {
			for(long i = L; i < R; i++) {
				for(long j = L + 1; j <= R; j++) {
					long c = i % 2019;
					long d = j % 2019;
					long check = c * d;
					long checkValue = check % 2019;
					if(checkValue <= base) {
						base = checkValue;
					}
				}
			}
			System.out.println(base);
		}
	}
}