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();
    int tmp=10000;
    if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    }
    
  }
  

  
} 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();
    int tmp=10000;
    if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    }
    
  }
  

  
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int tmp=10000;
    if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    }
    
  } main {
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int tmp=10000;
    if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    }
    
  } 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 int tmp=10000; tmp 10000 if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    } r-l>=2019 r-l r l 2019 {
      System.out.println(0);
      return;
    } System.out.println(0) System.out.println System.out System System.out 0 return; {
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    } l=l%2019 l l%2019 l 2019 r=r%2019 r r%2019 r 2019 for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      } int i=l; int i=l; i l i<=r-1 i r-1 r 1 i++ i++ i {
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      } {
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      } for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        } int j=l+1; int j=l+1; j l+1 l 1 j<=r j r j++ j++ j {
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        } {
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        } if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          } tmp>(i*j)%2019 tmp (i*j)%2019 (i*j) i j 2019 {
            tmp=(i*j)%2019;
          } tmp=(i*j)%2019 tmp (i*j)%2019 (i*j) i j 2019 System.out.println(tmp) System.out.println System.out System System.out tmp 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();
    int tmp=10000;
    if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    }
    
  }
  

  
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int tmp=10000;
    if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    }
    
  }
  

  
} 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();
    int tmp=10000;
    if(r-l>=2019){
      System.out.println(0);
      return;
    }else{
      l=l%2019;
      r=r%2019;
      for(int i=l;i<=r-1;i++){
        for(int j=l+1;j<=r;j++){
          if(tmp>(i*j)%2019){
            tmp=(i*j)%2019;
          }
        }
      }
      System.out.println(tmp);
      
      
    }
    
  }
  

  
}