import java.util.*;
public class Main {
  
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  }  
} import java.util.*; util.* java public class Main {
  
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  }  
} Main public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  } main {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    } (R / 2019) > (L / 2019) (R / 2019) R 2019 (L / 2019) L 2019 {
      System.out.println(0);
      return;
    } System.out.println(0) System.out.println System.out System System.out 0 return; int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    } int l = L; int l = L; l L l < R l R l++ l++ l {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    } {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    } for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      } int r = l+1; int r = l+1; r l+1 l 1 r <=R r R r++ r++ r {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      } {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      } int mod = (int)(((long)l*r)%(long)2019); mod (int)(((long)l*r)%(long)2019) ((long)l*r) (long)l r (long)2019 if (mod < ans) {
          ans = mod;
        } mod < ans mod ans {
          ans = mod;
        } ans = mod ans mod System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
  
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  }  
} public class Main {
  
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  }  
} Main
import java.util.*;
public class Main {
  
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  }  
}
