import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = 2019;
		int L = sc.nextInt();
		int R = sc.nextInt();
		int ans = M;
		if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = 2019;
		int L = sc.nextInt();
		int R = sc.nextInt();
		int ans = M;
		if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = 2019;
		int L = sc.nextInt();
		int R = sc.nextInt();
		int ans = M;
		if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int M = 2019;
		int L = sc.nextInt();
		int R = sc.nextInt();
		int ans = M;
		if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int M = 2019; M 2019 int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc int ans = M; ans M if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} R - L <= M R - L R L M {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			} int i = L; int i = L; i L i <= R i R i++ i++ i {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			} {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			} for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				} {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				} ans = Math.min(((i%M) * (j%M)) % M, ans) ans Math.min(((i%M) * (j%M)) % M, ans) Math.min Math ((i%M) * (j%M)) % M ((i%M) * (j%M)) (i%M) i M (j%M) j M M ans {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} L = L % M L L % M L M R = (R % M) + M R (R % M) + M (R % M) R M M for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			} int i = L; int i = L; i L i <= R i R i++ i++ i {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			} {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			} for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				} {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				} ans = Math.min(((i%M) * (j%M)) % M, ans) ans Math.min(((i%M) * (j%M)) % M, ans) Math.min Math ((i%M) * (j%M)) % M ((i%M) * (j%M)) (i%M) i M (j%M) j M M ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = 2019;
		int L = sc.nextInt();
		int R = sc.nextInt();
		int ans = M;
		if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = 2019;
		int L = sc.nextInt();
		int R = sc.nextInt();
		int ans = M;
		if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = 2019;
		int L = sc.nextInt();
		int R = sc.nextInt();
		int ans = M;
		if (R - L <= M) {
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		} else {
			L = L % M;
			R = (R % M) + M;
			for (int i = L; i <= R; i++) {
				for (int j = i + 1; j <= R; j++) {
					ans = Math.min(((i%M) * (j%M)) % M, ans);
				}
			}
		}
		System.out.println(ans);
	}
}
