import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
 
		long a,b;
 
		Scanner sc = new Scanner(System.in);
 
		a = sc.nextLong();
		b = sc.nextLong();
 
		long ans = 2018;
 
		if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		}
 
			System.out.println(ans);
 	}
  
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
 
		long a,b;
 
		Scanner sc = new Scanner(System.in);
 
		a = sc.nextLong();
		b = sc.nextLong();
 
		long ans = 2018;
 
		if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		}
 
			System.out.println(ans);
 	}
  
} Main public static void main(String[] args) {
 
		long a,b;
 
		Scanner sc = new Scanner(System.in);
 
		a = sc.nextLong();
		b = sc.nextLong();
 
		long ans = 2018;
 
		if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		}
 
			System.out.println(ans);
 	} main {
 
		long a,b;
 
		Scanner sc = new Scanner(System.in);
 
		a = sc.nextLong();
		b = sc.nextLong();
 
		long ans = 2018;
 
		if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		}
 
			System.out.println(ans);
 	} long a a b; b Scanner sc = new Scanner(System.in); sc new Scanner(System.in) a = sc.nextLong() a sc.nextLong() sc.nextLong sc b = sc.nextLong() b sc.nextLong() sc.nextLong sc long ans = 2018; ans 2018 if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		} b - a >= 2019 b - a b a 2019 {
			ans = 0;
		} ans = 0 ans 0 {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		} for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			} long i = a; long i = a; i a i < b i b ++i ++i i {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			} {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			} for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				} long j = i+1; long j = i+1; j i+1 i 1 j <= b j b ++j ++j j {
					ans = Math.min(ans, (i * j) % 2019);
				} {
					ans = Math.min(ans, (i * j) % 2019);
				} ans = Math.min(ans, (i * j) % 2019) ans Math.min(ans, (i * j) % 2019) Math.min Math ans (i * j) % 2019 (i * j) i j 2019 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) {
 
		long a,b;
 
		Scanner sc = new Scanner(System.in);
 
		a = sc.nextLong();
		b = sc.nextLong();
 
		long ans = 2018;
 
		if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		}
 
			System.out.println(ans);
 	}
  
} public class Main {
	public static void main(String[] args) {
 
		long a,b;
 
		Scanner sc = new Scanner(System.in);
 
		a = sc.nextLong();
		b = sc.nextLong();
 
		long ans = 2018;
 
		if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		}
 
			System.out.println(ans);
 	}
  
} Main
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
 
		long a,b;
 
		Scanner sc = new Scanner(System.in);
 
		a = sc.nextLong();
		b = sc.nextLong();
 
		long ans = 2018;
 
		if (b - a >= 2019) {
			ans = 0;
		} else {
 
			for (long i = a; i < b; ++i) {
				for (long j = i+1; j <= b; ++j) {
					ans = Math.min(ans, (i * j) % 2019);
				}
 
			}
  
		}
 
			System.out.println(ans);
 	}
  
}
