import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    r = Math.min(r,(l+2019));
    long mod = 2019L;
    long ans = (long)Math.pow(10,9)+7;
    for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java import java.io.*; io.* java import java.math.*; math.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    r = Math.min(r,(l+2019));
    long mod = 2019L;
    long ans = (long)Math.pow(10,9)+7;
    for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    r = Math.min(r,(l+2019));
    long mod = 2019L;
    long ans = (long)Math.pow(10,9)+7;
    for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    r = Math.min(r,(l+2019));
    long mod = 2019L;
    long ans = (long)Math.pow(10,9)+7;
    for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    }
    System.out.println(ans);
  } 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 r = Math.min(r,(l+2019)) r Math.min(r,(l+2019)) Math.min Math r (l+2019) l 2019 long mod = 2019L; mod 2019L long ans = (long)Math.pow(10,9)+7; ans (long)Math.pow(10,9)+7 (long)Math.pow(10,9) Math.pow Math 10 9 7 for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    } long i = l; long i = l; i l i < r i r i++ i++ i {
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    } {
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    } for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        } long j = i+1; long j = i+1; j i+1 i 1 j <= r j r j++ j++ j {
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        } {
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        } long tmp = ((i%mod)*(j%mod))%mod; tmp ((i%mod)*(j%mod))%mod ((i%mod)*(j%mod)) (i%mod) i mod (j%mod) j mod mod ans = Math.min(ans,tmp) ans Math.min(ans,tmp) Math.min Math ans tmp 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);
    long l = sc.nextLong();
    long r = sc.nextLong();
    r = Math.min(r,(l+2019));
    long mod = 2019L;
    long ans = (long)Math.pow(10,9)+7;
    for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    }
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    r = Math.min(r,(l+2019));
    long mod = 2019L;
    long ans = (long)Math.pow(10,9)+7;
    for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    }
    System.out.println(ans);
  }
} Main
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    r = Math.min(r,(l+2019));
    long mod = 2019L;
    long ans = (long)Math.pow(10,9)+7;
    for(long i = l; i < r; i++){
        for(long j = i+1; j <= r; j++){
            long tmp = ((i%mod)*(j%mod))%mod;
            ans = Math.min(ans,tmp);
        }
    }
    System.out.println(ans);
  }
}