import java.util.*;
public class Main {

  public static void main (String[] args) {

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

    long min = 2019;

    for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < 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.nextInt();
    long R = sc.nextInt();
    sc.close();

    long min = 2019;

    for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      }
    }

    System.out.println(min);

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

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

    long min = 2019;

    for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      }
    }

    System.out.println(min);

  } main {

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

    long min = 2019;

    for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      }
    }

    System.out.println(min);

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextInt(); L sc.nextInt() sc.nextInt sc long R = sc.nextInt(); R sc.nextInt() sc.nextInt sc sc.close() sc.close sc long min = 2019; min 2019 for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      }
    } int i = 0; int i = 0; i 0 i < 2019 i 2019 i++ i++ i {
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      }
    } {
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      }
    } for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      } int j = i + 1; int j = i + 1; j i + 1 i 1 j < 2019 j 2019 j++ j++ j {
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      } {
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      } long a = L + i; a L + i L i long b = L + j; b L + j L j if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        } a <= R && b <= R a <= R a R b <= R b R {
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        } long m = (a*b)%2019; m (a*b)%2019 (a*b) a b 2019 if (m < min){
            min = m;
          } m < min m min {
            min = m;
          } min = m 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.nextInt();
    long R = sc.nextInt();
    sc.close();

    long min = 2019;

    for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < 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.nextInt();
    long R = sc.nextInt();
    sc.close();

    long min = 2019;

    for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < 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.nextInt();
    long R = sc.nextInt();
    sc.close();

    long min = 2019;

    for(int i = 0; i < 2019; i++){
      for(int j = i + 1; j < 2019; j++){
        long a = L + i;
        long b = L + j;
        if (a <= R && b <= R){
          long m = (a*b)%2019;
          if (m < min){
            min = m;
          }
        }
      }
    }

    System.out.println(min);

  }
  
}