import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    long L = sc.nextLong();
    long R = sc.nextLong();

    sc.close();

    long r = Math.min(R, L + 2019);

    long min = 2018;
    
    for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    }

    System.out.println(min);
    
  }

} import java.util.*; util.* java public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    long L = sc.nextLong();
    long R = sc.nextLong();

    sc.close();

    long r = Math.min(R, L + 2019);

    long min = 2018;
    
    for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    }

    System.out.println(min);
    
  }

} Main public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    long L = sc.nextLong();
    long R = sc.nextLong();

    sc.close();

    long r = Math.min(R, L + 2019);

    long min = 2018;
    
    for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    }

    System.out.println(min);
    
  } main {

    Scanner sc = new Scanner(System.in);
    
    long L = sc.nextLong();
    long R = sc.nextLong();

    sc.close();

    long r = Math.min(R, L + 2019);

    long min = 2018;
    
    for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    }

    System.out.println(min);
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextLong(); L sc.nextLong() sc.nextLong sc long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc sc.close() sc.close sc long r = Math.min(R, L + 2019); r Math.min(R, L + 2019) Math.min Math R L + 2019 L 2019 long min = 2018; min 2018 for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    } long i = L; long i = L; i L i <= r i r i++ i++ i {
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    } {
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    } for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      } {
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      } long m = (i % 2019) * (j % 2019) % 2019; m (i % 2019) * (j % 2019) % 2019 (i % 2019) * (j % 2019) (i % 2019) i 2019 (j % 2019) j 2019 2019 min = Math.min(min, m) min Math.min(min, m) Math.min Math min m 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);
    
    long L = sc.nextLong();
    long R = sc.nextLong();

    sc.close();

    long r = Math.min(R, L + 2019);

    long min = 2018;
    
    for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    }

    System.out.println(min);
    
  }

} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    long L = sc.nextLong();
    long R = sc.nextLong();

    sc.close();

    long r = Math.min(R, L + 2019);

    long min = 2018;
    
    for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    }

    System.out.println(min);
    
  }

} Main
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    long L = sc.nextLong();
    long R = sc.nextLong();

    sc.close();

    long r = Math.min(R, L + 2019);

    long min = 2018;
    
    for (long i = L; i <= r; i++){
      for (long j = i + 1; j <= r; j++){
        long m = (i % 2019) * (j % 2019) % 2019;
        min = Math.min(min, m);
      }
    }

    System.out.println(min);
    
  }

}