import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int lNum = s.nextInt();
		int rNum = s.nextInt();
		int ldim = lNum % 2019;
		int rdim = rNum % 2019;
		s.close();
		int min = 2019;
		if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		}
		System.out.println(min);

	}

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

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int lNum = s.nextInt();
		int rNum = s.nextInt();
		int ldim = lNum % 2019;
		int rdim = rNum % 2019;
		s.close();
		int min = 2019;
		if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		}
		System.out.println(min);

	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int lNum = s.nextInt();
		int rNum = s.nextInt();
		int ldim = lNum % 2019;
		int rdim = rNum % 2019;
		s.close();
		int min = 2019;
		if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		}
		System.out.println(min);

	} main {
		Scanner s = new Scanner(System.in);
		int lNum = s.nextInt();
		int rNum = s.nextInt();
		int ldim = lNum % 2019;
		int rdim = rNum % 2019;
		s.close();
		int min = 2019;
		if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		}
		System.out.println(min);

	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int lNum = s.nextInt(); lNum s.nextInt() s.nextInt s int rNum = s.nextInt(); rNum s.nextInt() s.nextInt s int ldim = lNum % 2019; ldim lNum % 2019 lNum 2019 int rdim = rNum % 2019; rdim rNum % 2019 rNum 2019 s.close() s.close s int min = 2019; min 2019 if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		} lNum / 2019 == rNum / 2019 lNum / 2019 lNum 2019 rNum / 2019 rNum 2019 {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		} for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			} int i = ldim; int i = ldim; i ldim i < rdim i rdim i++ i++ i {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			} {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			} for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= rdim j rdim j++ j++ j {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				} {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				} int amari = (i * j) % 2019; amari (i * j) % 2019 (i * j) i j 2019 if (amari < min) {
						min = amari;
					} amari < min amari min {
						min = amari;
					} min = amari min amari if(amari == 0) {
						min = 0;
						break;
					} amari == 0 amari 0 {
						min = 0;
						break;
					} min = 0 min 0 break; {
			min = 0;
		} min = 0 min 0 System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int lNum = s.nextInt();
		int rNum = s.nextInt();
		int ldim = lNum % 2019;
		int rdim = rNum % 2019;
		s.close();
		int min = 2019;
		if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		}
		System.out.println(min);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int lNum = s.nextInt();
		int rNum = s.nextInt();
		int ldim = lNum % 2019;
		int rdim = rNum % 2019;
		s.close();
		int min = 2019;
		if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		}
		System.out.println(min);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int lNum = s.nextInt();
		int rNum = s.nextInt();
		int ldim = lNum % 2019;
		int rdim = rNum % 2019;
		s.close();
		int min = 2019;
		if (lNum / 2019 == rNum / 2019) {
			for (int i = ldim; i < rdim; i++) {
				for (int j = i + 1; j <= rdim; j++) {
					int amari = (i * j) % 2019;
					if (amari < min) {
						min = amari;
					}
					if(amari == 0) {
						min = 0;
						break;
					}
				}
			}
		}else {
			min = 0;
		}
		System.out.println(min);

	}

}
