import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        long l=sc.nextLong();
        long r=sc.nextLong();
		long min=l*(l+1)%2019;
    
 	if((r-l)>=2018){
    		System.out.println(0);
    	}else if((r-l)<(2019-l%2019)){
     		for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            }
      	System.out.println(min);
   	 }else{

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

    	System.out.println(0);
    }
    } main {
	Scanner sc=new Scanner(System.in);
        long l=sc.nextLong();
        long r=sc.nextLong();
		long min=l*(l+1)%2019;
    
 	if((r-l)>=2018){
    		System.out.println(0);
    	}else if((r-l)<(2019-l%2019)){
     		for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            }
      	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 long min=l*(l+1)%2019; min l*(l+1)%2019 l*(l+1) l (l+1) l 1 2019 if((r-l)>=2018){
    		System.out.println(0);
    	}else if((r-l)<(2019-l%2019)){
     		for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            }
      	System.out.println(min);
   	 }else{

    	System.out.println(0);
    } (r-l)>=2018 (r-l) r l 2018 {
    		System.out.println(0);
    	} System.out.println(0) System.out.println System.out System System.out 0 if((r-l)<(2019-l%2019)){
     		for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            }
      	System.out.println(min);
   	 }else{

    	System.out.println(0);
    } (r-l)<(2019-l%2019) (r-l) r l (2019-l%2019) 2019 l%2019 l 2019 {
     		for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            }
      	System.out.println(min);
   	 } for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            } long e=l; long e=l; e l e<r e r e++ e++ e {
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            } {
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            } for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              } long f=e+1; long f=e+1; f e+1 e 1 f<=r f r f++ f++ f {
            	 min=Math.min(min,e*f%2019);
              } {
            	 min=Math.min(min,e*f%2019);
              } min=Math.min(min,e*f%2019) min Math.min(min,e*f%2019) Math.min Math min e*f%2019 e*f e f 2019 if(min==0){break;} min==0 min 0 {break;} break; 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
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        long l=sc.nextLong();
        long r=sc.nextLong();
		long min=l*(l+1)%2019;
    
 	if((r-l)>=2018){
    		System.out.println(0);
    	}else if((r-l)<(2019-l%2019)){
     		for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            }
      	System.out.println(min);
   	 }else{

    	System.out.println(0);
    }
    }
}
