import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	long min = Integer.MAX_VALUE;
      	sc.close();
      	if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        }
      	
      	
    }
 
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	long min = Integer.MAX_VALUE;
      	sc.close();
      	if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        }
      	
      	
    }
 
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	long min = Integer.MAX_VALUE;
      	sc.close();
      	if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        }
      	
      	
    } main {
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	long min = Integer.MAX_VALUE;
      	sc.close();
      	if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        }
      	
      	
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc long min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE sc.close() sc.close sc if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        } b - a >= 2019 b - a b a 2019 {
        	System.out.print(0);
        } System.out.print(0) System.out.print System.out System System.out 0 {
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        } for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        } long i = a; long i = a; i a i < b i b i ++ i ++ i {
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        } {
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        } for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= b j b j ++ j ++ j {
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            } {
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            } if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                } min > ((i * j) % 2019) min ((i * j) % 2019) (i * j) i j 2019 {
                	min = (i * j) % 2019;
                } min = (i * j) % 2019 min (i * j) % 2019 (i * j) i j 2019 if(min == 0){
                	break;
                } min == 0 min 0 {
                	break;
                } break; System.out.print(min) System.out.print System.out System System.out min String[] args args public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	long min = Integer.MAX_VALUE;
      	sc.close();
      	if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        }
      	
      	
    }
 
} public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	long min = Integer.MAX_VALUE;
      	sc.close();
      	if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        }
      	
      	
    }
 
} Main
import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	long min = Integer.MAX_VALUE;
      	sc.close();
      	if(b - a >= 2019){
        	System.out.print(0);
        }
      	else{
      	for(long i = a; i < b; i ++){
          	for(long j = i + 1; j <= b; j ++){
            	if(min > ((i * j) % 2019)){
                	min = (i * j) % 2019;
                }
              	if(min == 0){
                	break;
                }
            }
        }
          System.out.print(min);
        }
      	
      	
    }
 
}