import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long l = scan.nextLong();
    long r = scan.nextLong();

    if (l == 0){
      System.out.println(0);
      return;
    }

    if (r-l >= 2018){
      System.out.println(0);
      return;
    }

    int a1 = (int) l%2019;
    int a2 = (int) r%2019;
    
    int small = 2019;
    for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    }

    System.out.println(small%2019);
  }

} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long l = scan.nextLong();
    long r = scan.nextLong();

    if (l == 0){
      System.out.println(0);
      return;
    }

    if (r-l >= 2018){
      System.out.println(0);
      return;
    }

    int a1 = (int) l%2019;
    int a2 = (int) r%2019;
    
    int small = 2019;
    for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    }

    System.out.println(small%2019);
  }

} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long l = scan.nextLong();
    long r = scan.nextLong();

    if (l == 0){
      System.out.println(0);
      return;
    }

    if (r-l >= 2018){
      System.out.println(0);
      return;
    }

    int a1 = (int) l%2019;
    int a2 = (int) r%2019;
    
    int small = 2019;
    for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    }

    System.out.println(small%2019);
  } main {
    Scanner scan = new Scanner(System.in);
    long l = scan.nextLong();
    long r = scan.nextLong();

    if (l == 0){
      System.out.println(0);
      return;
    }

    if (r-l >= 2018){
      System.out.println(0);
      return;
    }

    int a1 = (int) l%2019;
    int a2 = (int) r%2019;
    
    int small = 2019;
    for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    }

    System.out.println(small%2019);
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long l = scan.nextLong(); l scan.nextLong() scan.nextLong scan long r = scan.nextLong(); r scan.nextLong() scan.nextLong scan if (l == 0){
      System.out.println(0);
      return;
    } l == 0 l 0 {
      System.out.println(0);
      return;
    } System.out.println(0) System.out.println System.out System System.out 0 return; if (r-l >= 2018){
      System.out.println(0);
      return;
    } r-l >= 2018 r-l r l 2018 {
      System.out.println(0);
      return;
    } System.out.println(0) System.out.println System.out System System.out 0 return; int a1 = (int) l%2019; a1 (int) l%2019 (int) l 2019 int a2 = (int) r%2019; a2 (int) r%2019 (int) r 2019 int small = 2019; small 2019 for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    } int j=a1; int j=a1; j a1 j < a2 j a2 j++ j++ j {
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    } {
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    } for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      } int k = j+1; int k = j+1; k j+1 j 1 k<=a2 k a2 k++ k++ k {
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      } {
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      } int kk = (int) (j*k)%2019; kk (int) (j*k)%2019 (int) (j*k) j k 2019 if (kk<small){
          small = kk;
        } kk<small kk small {
          small = kk;
        } small = kk small kk System.out.println(small%2019) System.out.println System.out System System.out small%2019 small 2019 String[] args args public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long l = scan.nextLong();
    long r = scan.nextLong();

    if (l == 0){
      System.out.println(0);
      return;
    }

    if (r-l >= 2018){
      System.out.println(0);
      return;
    }

    int a1 = (int) l%2019;
    int a2 = (int) r%2019;
    
    int small = 2019;
    for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    }

    System.out.println(small%2019);
  }

} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long l = scan.nextLong();
    long r = scan.nextLong();

    if (l == 0){
      System.out.println(0);
      return;
    }

    if (r-l >= 2018){
      System.out.println(0);
      return;
    }

    int a1 = (int) l%2019;
    int a2 = (int) r%2019;
    
    int small = 2019;
    for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    }

    System.out.println(small%2019);
  }

} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long l = scan.nextLong();
    long r = scan.nextLong();

    if (l == 0){
      System.out.println(0);
      return;
    }

    if (r-l >= 2018){
      System.out.println(0);
      return;
    }

    int a1 = (int) l%2019;
    int a2 = (int) r%2019;
    
    int small = 2019;
    for (int j=a1; j < a2; j++){
      for (int k = j+1;k<=a2;k++){
        int kk = (int) (j*k)%2019;
        if (kk<small){
          small = kk;
        }
      }
    }

    System.out.println(small%2019);
  }

}
