import java.util.*;


 class Main
 { 
	public static void main(String args[])
 	{ 

		Scanner sc =new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		
		long res = Integer.MAX_VALUE;
		
		loop: for(long i = l; i <= r; i++){
			for(long j = i+1; j <= r; j++){
				res = Math.min(res, i*j%2019);
				
				if(res == 0) break loop;
			}
		}
		
		System.out.println(res);

 	}
 } import java.util.*; util.* java class Main
 { 
	public static void main(String args[])
 	{ 

		Scanner sc =new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		
		long res = Integer.MAX_VALUE;
		
		loop: for(long i = l; i <= r; i++){
			for(long j = i+1; j <= r; j++){
				res = Math.min(res, i*j%2019);
				
				if(res == 0) break loop;
			}
		}
		
		System.out.println(res);

 	}
 } Main public static void main(String args[])
 	{ 

		Scanner sc =new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		
		long res = Integer.MAX_VALUE;
		
		loop: for(long i = l; i <= r; i++){
			for(long j = i+1; j <= r; j++){
				res = Math.min(res, i*j%2019);
				
				if(res == 0) break loop;
			}
		}
		
		System.out.println(res);

 	} main { 

		Scanner sc =new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		
		long res = Integer.MAX_VALUE;
		
		loop: for(long i = l; i <= r; i++){
			for(long j = i+1; j <= r; j++){
				res = Math.min(res, i*j%2019);
				
				if(res == 0) break loop;
			}
		}
		
		System.out.println(res);

 	} Scanner sc =new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextInt(); l sc.nextInt() sc.nextInt sc long r = sc.nextInt(); r sc.nextInt() sc.nextInt sc long res = Integer.MAX_VALUE; res Integer.MAX_VALUE Integer Integer.MAX_VALUE System.out.println(res) System.out.println System.out System System.out res String args[] args
import java.util.*;


 class Main
 { 
	public static void main(String args[])
 	{ 

		Scanner sc =new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		
		long res = Integer.MAX_VALUE;
		
		loop: for(long i = l; i <= r; i++){
			for(long j = i+1; j <= r; j++){
				res = Math.min(res, i*j%2019);
				
				if(res == 0) break loop;
			}
		}
		
		System.out.println(res);

 	}
 }