import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int L = sc.nextInt();
   int R = sc.nextInt();
   boolean zero = false; 
   
   if(L-R>=2019) zero = true;
   for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   }
   L = L%2019;
   R = R%2019;
   int min = 2017*2018;
   if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   }
   if(zero) System.out.println(0);
   else System.out.println(min);
 }
} import java.util.*; util.* java public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int L = sc.nextInt();
   int R = sc.nextInt();
   boolean zero = false; 
   
   if(L-R>=2019) zero = true;
   for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   }
   L = L%2019;
   R = R%2019;
   int min = 2017*2018;
   if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   }
   if(zero) System.out.println(0);
   else System.out.println(min);
 }
} Main public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int L = sc.nextInt();
   int R = sc.nextInt();
   boolean zero = false; 
   
   if(L-R>=2019) zero = true;
   for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   }
   L = L%2019;
   R = R%2019;
   int min = 2017*2018;
   if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   }
   if(zero) System.out.println(0);
   else System.out.println(min);
 } main {
   Scanner sc = new Scanner(System.in);
   int L = sc.nextInt();
   int R = sc.nextInt();
   boolean zero = false; 
   
   if(L-R>=2019) zero = true;
   for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   }
   L = L%2019;
   R = R%2019;
   int min = 2017*2018;
   if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   }
   if(zero) System.out.println(0);
   else System.out.println(min);
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc boolean zero = false; zero false if(L-R>=2019) zero = true; L-R>=2019 L-R L R 2019 zero = true zero true for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   } int i = L; int i = L; i L i<R i R i++ i++ i {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   } {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   } if(i%2019==0) 
     {
       zero = true;
       break;
     } i%2019==0 i%2019 i 2019 0 {
       zero = true;
       break;
     } zero = true zero true break; L = L%2019 L L%2019 L 2019 R = R%2019 R R%2019 R 2019 int min = 2017*2018; min 2017*2018 2017 2018 if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   } !zero zero {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   } for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     } int i = L; int i = L; i L i<R i R i++ i++ i {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     } {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     } for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       } int k = i+1; int k = i+1; k i+1 i 1 k<=R k R k++ k++ k {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       } {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       } if(min>(i*k)%2019) min = (i*k)%2019; min>(i*k)%2019 min (i*k)%2019 (i*k) i k 2019 min = (i*k)%2019 min (i*k)%2019 (i*k) i k 2019 if(zero) System.out.println(0);
   else System.out.println(min); zero System.out.println(0) System.out.println System.out System System.out 0 System.out.println(min) System.out.println 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 L = sc.nextInt();
   int R = sc.nextInt();
   boolean zero = false; 
   
   if(L-R>=2019) zero = true;
   for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   }
   L = L%2019;
   R = R%2019;
   int min = 2017*2018;
   if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   }
   if(zero) System.out.println(0);
   else System.out.println(min);
 }
} public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int L = sc.nextInt();
   int R = sc.nextInt();
   boolean zero = false; 
   
   if(L-R>=2019) zero = true;
   for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   }
   L = L%2019;
   R = R%2019;
   int min = 2017*2018;
   if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   }
   if(zero) System.out.println(0);
   else System.out.println(min);
 }
} Main
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int L = sc.nextInt();
   int R = sc.nextInt();
   boolean zero = false; 
   
   if(L-R>=2019) zero = true;
   for(int i = L;i<R;i++)
   {
     if(i%2019==0) 
     {
       zero = true;
       break;
     }
   }
   L = L%2019;
   R = R%2019;
   int min = 2017*2018;
   if(!zero)
   {
     for(int i = L;i<R;i++)
     {
       for(int k = i+1;k<=R;k++)
       {
          if(min>(i*k)%2019) min = (i*k)%2019;         
       }
     }
   }
   if(zero) System.out.println(0);
   else System.out.println(min);
 }
}