
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();

		long min = 9999;
		for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		}
		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 l = sc.nextLong();
		long r = sc.nextLong();

		long min = 9999;
		for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
		sc.close();

	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long min = 9999;
		for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
		sc.close();

	} main {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long min = 9999;
		for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
		sc.close();

	} 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 long min = 9999; min 9999 for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		} long i = l ; long i = l ; i l i < r i r i++ i++ i {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		} {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		} for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			} long j = i + 1 ; long j = i + 1 ; j i + 1 i 1 j <= r j r j++ j++ j {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			} {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			} long mod = (i * j) % 2019; mod (i * j) % 2019 (i * j) i j 2019 if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				} mod == 0L mod 0L {
					System.out.println(mod);
					System.exit(0);;
				} System.out.println(mod) System.out.println System.out System System.out mod System.exit(0) System.exit System 0 if(mod < min) {
					min = mod;
				} mod < min mod min {
					min = mod;
				} min = mod min mod 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 l = sc.nextLong();
		long r = sc.nextLong();

		long min = 9999;
		for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
		sc.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long min = 9999;
		for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		}
		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 l = sc.nextLong();
		long r = sc.nextLong();

		long min = 9999;
		for(long i = l ; i < r ; i++) {
			for(long j = i + 1 ; j <= r ; j++) {
				long mod = (i * j) % 2019;
				if(mod == 0L) {
					System.out.println(mod);
					System.exit(0);;
				}
				if(mod < min) {
					min = mod;
				}
			}
		}
		System.out.println(min);
		sc.close();

	}

}
