

import java.util.*;
public class Main {
	
	public static void main(String[] args){
		
		Scanner s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
} import java.util.*; util.* java public class Main {
	
	public static void main(String[] args){
		
		Scanner s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
} Main public static void main(String[] args){
		
		Scanner s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	} main {
		
		Scanner s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) long l = s.nextLong() l s.nextLong() s.nextLong s r = s.nextLong(); r s.nextLong() s.nextLong s long[] arr = new long[2019]; arr new long[2019] 2019 Arrays.fill(arr, -1) Arrays.fill Arrays arr -1 1 long i = l; i l while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		} i <= r i r {
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		} int rem = (int) (i%2019); rem (int) (i%2019) i 2019 if(arr[rem] != -1) break; arr[rem] != -1 arr[rem] arr rem -1 1 break; arr[rem] = i arr[rem] arr rem i ++i i long ans = ((l%2019)*(r%2019))%2019; ans ((l%2019)*(r%2019))%2019 ((l%2019)*(r%2019)) (l%2019) l 2019 (r%2019) r 2019 2019 for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		} int i1 = 0; int i1 = 0; i1 0 i1 < arr.length i1 arr.length arr arr.length ++i1 ++i1 i1 {
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		} {
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		} for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			} int j = 0; int j = 0; j 0 j < arr.length j arr.length arr arr.length ++j ++j j {
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			} {
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			} if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				} i1 != j i1 j {
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				} if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					} arr[i1] != -1 && arr[j] != -1 arr[i1] != -1 arr[i1] arr i1 -1 1 arr[j] != -1 arr[j] arr j -1 1 {
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					} long val = ((arr[i1]%2019)*(arr[j]%2019))%2019; val ((arr[i1]%2019)*(arr[j]%2019))%2019 ((arr[i1]%2019)*(arr[j]%2019)) (arr[i1]%2019) arr[i1] arr i1 2019 (arr[j]%2019) arr[j] arr j 2019 2019 if(val < ans) ans = val; val < ans val ans ans = val ans val 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 s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
} public class Main {
	
	public static void main(String[] args){
		
		Scanner s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
} Main


import java.util.*;
public class Main {
	
	public static void main(String[] args){
		
		Scanner s = new Scanner(System.in);
		long l = s.nextLong() , r = s.nextLong();
		
		long[] arr = new long[2019];
		Arrays.fill(arr, -1);
		
		long i = l;
		
		while( i <= r ){
			
			int rem = (int) (i%2019);
			if(arr[rem] != -1) break;
			arr[rem] = i;
			++i;
			
		}
		
		
		long ans = ((l%2019)*(r%2019))%2019;
		
		for( int i1 = 0;i1 < arr.length;++i1){
			
			for(int j = 0;j < arr.length ;++j){
			
				if(i1 != j){
					if(arr[i1] != -1 && arr[j] != -1){
						long val = ((arr[i1]%2019)*(arr[j]%2019))%2019;
						if(val < ans) ans = val;
						
					}
				}
				
			}
			
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
}
