import java.util.Scanner;
 
class Main {
  public static void main(String args[]) {
    Scanner scanner = new Scanner(System.in);
    long L = scanner.nextLong();
    long R = scanner.nextLong();
    long min = 2018;
    
    if((R-L)<2019){
      for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      }
    }else{
      min = 0;
    }
    System.out.println(min);
    
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String args[]) {
    Scanner scanner = new Scanner(System.in);
    long L = scanner.nextLong();
    long R = scanner.nextLong();
    long min = 2018;
    
    if((R-L)<2019){
      for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      }
    }else{
      min = 0;
    }
    System.out.println(min);
    
  }
} Main public static void main(String args[]) {
    Scanner scanner = new Scanner(System.in);
    long L = scanner.nextLong();
    long R = scanner.nextLong();
    long min = 2018;
    
    if((R-L)<2019){
      for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      }
    }else{
      min = 0;
    }
    System.out.println(min);
    
  } main {
    Scanner scanner = new Scanner(System.in);
    long L = scanner.nextLong();
    long R = scanner.nextLong();
    long min = 2018;
    
    if((R-L)<2019){
      for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      }
    }else{
      min = 0;
    }
    System.out.println(min);
    
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long L = scanner.nextLong(); L scanner.nextLong() scanner.nextLong scanner long R = scanner.nextLong(); R scanner.nextLong() scanner.nextLong scanner long min = 2018; min 2018 if((R-L)<2019){
      for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      }
    }else{
      min = 0;
    } (R-L)<2019 (R-L) R L 2019 {
      for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      }
    } for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      } long i=L; long i=L; i L i<R i R i++ i++ i {
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      } {
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      } for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        } long j=(i+1); long j=(i+1); j (i+1) i 1 j<=R j R j++ j++ j {
          if(min>i*j%2019){
            min = i*j%2019;
          }
        } {
          if(min>i*j%2019){
            min = i*j%2019;
          }
        } 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 {
      min = 0;
    } min = 0 min 0 System.out.println(min) System.out.println System.out System System.out min String args[] args
import java.util.Scanner;
 
class Main {
  public static void main(String args[]) {
    Scanner scanner = new Scanner(System.in);
    long L = scanner.nextLong();
    long R = scanner.nextLong();
    long min = 2018;
    
    if((R-L)<2019){
      for(long i=L; i<R; i++){
        for(long j=(i+1); j<=R; j++){
          if(min>i*j%2019){
            min = i*j%2019;
          }
        }
      }
    }else{
      min = 0;
    }
    System.out.println(min);
    
  }
}