import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = 2018;
		if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = 2018;
		if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		}
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = 2018;
		if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = 2018;
		if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc int min = 2018; min 2018 if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		} R - L > 2019 R - L R L 2019 {
			System.out.print(0);
		} System.out.print(0) System.out.print System.out System System.out 0 {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		} int LMod = Math.floorMod(L, 2019); LMod Math.floorMod(L, 2019) Math.floorMod Math L 2019 int RMod = Math.floorMod(R, 2019); RMod Math.floorMod(R, 2019) Math.floorMod Math R 2019 if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			} LMod < RMod LMod RMod {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				} int i = LMod; int i = LMod; i LMod i < RMod i RMod i++ i++ i {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				} {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				} for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= RMod j RMod j++ j++ j {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					} {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					} int surPlus = (i * j) % 2019; surPlus (i * j) % 2019 (i * j) i j 2019 if (surPlus < min) {
							min = surPlus;
						} surPlus < min surPlus min {
							min = surPlus;
						} min = surPlus min surPlus System.out.print(min) System.out.print System.out System System.out min {
				System.out.print(0);
			} System.out.print(0) System.out.print System.out System System.out 0 String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = 2018;
		if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		}
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = 2018;
		if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = 2018;
		if (R - L > 2019) {
			System.out.print(0);
		} else {
			int LMod = Math.floorMod(L, 2019);
			int RMod = Math.floorMod(R, 2019);
			if (LMod < RMod) {
				for (int i = LMod; i < RMod; i++) {
					for (int j = i + 1; j <= RMod; j++) {
						int surPlus = (i * j) % 2019;
						if (surPlus < min) {
							min = surPlus;
						}
					}
				}
				System.out.print(min);
			} else {
				System.out.print(0);
			}
		}
	}
}
