import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(), r = sc.nextInt();
        int mod = 2019;
        boolean[] vis = new boolean[mod];
        for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        }
        long ans = mod-1;
        for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        }
        return ans;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(), r = sc.nextInt();
        int mod = 2019;
        boolean[] vis = new boolean[mod];
        for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        }
        long ans = mod-1;
        for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        }
        return ans;
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        System.out.println(main.solve());
    } main {
        Main main = new Main();
        System.out.println(main.solve());
    } Main main = new Main(); main new Main() System.out.println(main.solve()) System.out.println System.out System System.out main.solve() main.solve main String[] args args long solve(){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(), r = sc.nextInt();
        int mod = 2019;
        boolean[] vis = new boolean[mod];
        for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        }
        long ans = mod-1;
        for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        }
        return ans;
    } solve {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(), r = sc.nextInt();
        int mod = 2019;
        boolean[] vis = new boolean[mod];
        for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        }
        long ans = mod-1;
        for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        }
        return ans;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = sc.nextInt() l sc.nextInt() sc.nextInt sc r = sc.nextInt(); r sc.nextInt() sc.nextInt sc int mod = 2019; mod 2019 boolean[] vis = new boolean[mod]; vis new boolean[mod] mod for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        } int i=0; int i=0; i 0 i<mod&&i+l<=r i<mod i mod i+l<=r i+l i l r i++ i++ i {
            vis[(l+i)%mod] = true;
        } {
            vis[(l+i)%mod] = true;
        } vis[(l+i)%mod] = true vis[(l+i)%mod] vis (l+i)%mod (l+i) l i mod true long ans = mod-1; ans mod-1 mod 1 for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        } int i=0; int i=0; i 0 i<mod i mod i++ i++ i {
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        } {
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        } if(!vis[i]) continue; !vis[i] vis[i] vis i continue; for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            } int j=0; int j=0; j 0 j<mod j mod j++ j++ j {
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            } {
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            } if(j==i) continue; j==i j i continue; if(vis[j]) ans = Math.min(ans, i*j%mod); vis[j] vis j ans = Math.min(ans, i*j%mod) ans Math.min(ans, i*j%mod) Math.min Math ans i*j%mod i*j i j mod return ans; ans public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(), r = sc.nextInt();
        int mod = 2019;
        boolean[] vis = new boolean[mod];
        for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        }
        long ans = mod-1;
        for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        }
        return ans;
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(), r = sc.nextInt();
        int mod = 2019;
        boolean[] vis = new boolean[mod];
        for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        }
        long ans = mod-1;
        for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        }
        return ans;
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(), r = sc.nextInt();
        int mod = 2019;
        boolean[] vis = new boolean[mod];
        for(int i=0;i<mod&&i+l<=r;i++){
            vis[(l+i)%mod] = true;
        }
        long ans = mod-1;
        for(int i=0;i<mod;i++){
            if(!vis[i]) continue;
            for(int j=0;j<mod;j++){
                if(j==i) continue;
                if(vis[j]) ans = Math.min(ans, i*j%mod);
            }
        }
        return ans;
    }
}