import java.util.Scanner;

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

public class Main{
  public static void main(String[] args){
    long l, r;
    Scanner scanner = new Scanner(System.in);
    l = scanner.nextInt();
    r = scanner.nextInt();
    
    if(r - l >= 2019){
      System.out.println(0);
    }else{
      long min = 2018;
      for(long i = l; i <= r - 1; i++){
        for(long j = i + 1; j <= r; j++){
          long ij = (i * j) % 2019;
          if(ij < min){
            min = ij;
          }
        }
      }
      System.out.println(min);
    }
  }
}
