import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = Long.parseLong(sc.next());
		long R = Long.parseLong(sc.next());
		sc.close();
		long mod = 2018;
		long cal = 0;
		for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		}
		System.out.println(mod);
	}
} 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.parseLong(sc.next());
		long R = Long.parseLong(sc.next());
		sc.close();
		long mod = 2018;
		long cal = 0;
		for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		}
		System.out.println(mod);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = Long.parseLong(sc.next());
		long R = Long.parseLong(sc.next());
		sc.close();
		long mod = 2018;
		long cal = 0;
		for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		}
		System.out.println(mod);
	} main {
		Scanner sc = new Scanner(System.in);
		long L = Long.parseLong(sc.next());
		long R = Long.parseLong(sc.next());
		sc.close();
		long mod = 2018;
		long cal = 0;
		for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		}
		System.out.println(mod);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = Long.parseLong(sc.next()); L Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc long R = Long.parseLong(sc.next()); R Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc sc.close() sc.close sc long mod = 2018; mod 2018 long cal = 0; cal 0 for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 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++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		} {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		} for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 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 {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			} {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			} cal = (i * j)%2019 cal (i * j)%2019 (i * j) i j 2019 if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				} cal < mod cal mod {
					mod = cal;
				} mod = cal mod cal if(cal == 0) {
					System.out.println(0);
					return;
				} cal == 0 cal 0 {
					System.out.println(0);
					return;
				} System.out.println(0) System.out.println System.out System System.out 0 return; System.out.println(mod) System.out.println System.out System System.out mod String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = Long.parseLong(sc.next());
		long R = Long.parseLong(sc.next());
		sc.close();
		long mod = 2018;
		long cal = 0;
		for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		}
		System.out.println(mod);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = Long.parseLong(sc.next());
		long R = Long.parseLong(sc.next());
		sc.close();
		long mod = 2018;
		long cal = 0;
		for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		}
		System.out.println(mod);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = Long.parseLong(sc.next());
		long R = Long.parseLong(sc.next());
		sc.close();
		long mod = 2018;
		long cal = 0;
		for(long i = L;i <= R;i++) {
			for(long j = i+1;j <=R;j++) {
				cal = (i * j)%2019;
				if(cal < mod) {
					mod = cal;
				}else if(cal == 0) {
					System.out.println(0);
					return;
				}
			}
		}
		System.out.println(mod);
	}
}