import 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();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	}
} Main public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	} main {

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	} 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 if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		} R - L < 2019 R - L R L 2019 {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		} L = L % 2019 L L % 2019 L 2019 R = R % 2019 R R % 2019 R 2019 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			} L < R L R {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			} for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				} int i = (int)L; int i = (int)L; i (int)L i <= R - 1 i R - 1 R 1 i++ i++ i {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				} {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				} for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
						min = Math.min(min, (i * j) % 2019);
					} {
						min = Math.min(min, (i * j) % 2019);
					} min = Math.min(min, (i * j) % 2019) min Math.min(min, (i * j) % 2019) Math.min Math min (i * j) % 2019 (i * j) i j 2019 {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			} for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				} int i = 0; int i = 0; i 0 i <= 2018 i 2018 i++ i++ i {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				} {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				} if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					} i <= R || L <= i i <= R i R L <= i L i {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					} for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						} int j = 0; int j = 0; j 0 j <= 2018 j 2018 j++ j++ j {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						} {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						} if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							} (j <= R || L <= j) && i != j (j <= R || L <= j) j <= R j R L <= j L j i != j i j {
								min = Math.min(min, (i * j) % 2019);
							} min = Math.min(min, (i * j) % 2019) min Math.min(min, (i * j) % 2019) Math.min Math min (i * j) % 2019 (i * j) i j 2019 System.out.println(min) System.out.println System.out System System.out min {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 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();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	}
} public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	}
} Main
import 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();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	}
}