
import java.util.*;


public class Main {

    private static final int INF = 1000000007;
    private static final int INF1 = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();

        long result = INF1;
        if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        }

        System.out.println(result);

    }
} import java.util.*; util.* java public class Main {

    private static final int INF = 1000000007;
    private static final int INF1 = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();

        long result = INF1;
        if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        }

        System.out.println(result);

    }
} Main private static final int INF = 1000000007; INF 1000000007 private static final int INF1 = Integer.MAX_VALUE; INF1 Integer.MAX_VALUE Integer Integer.MAX_VALUE public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();

        long result = INF1;
        if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        }

        System.out.println(result);

    } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();

        long result = INF1;
        if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        }

        System.out.println(result);

    } 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 long result = INF1; result INF1 if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        } (l <= 2019 && 2019 <= r) l <= 2019 l 2019 2019 <= r 2019 r {
            result = 0;
        } result = 0 result 0 if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        } r < 2019 r 2019 {
            result = (r*(r-1)) % 2019;
        } result = (r*(r-1)) % 2019 result (r*(r-1)) % 2019 (r*(r-1)) r (r-1) r 1 2019 if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        } l > 2019 l 2019 {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        } long waru = l / 2019; waru l / 2019 l 2019 long warur = r / 2019; warur r / 2019 r 2019 if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            } waru < warur waru warur {
                result = 0;
            } result = 0 result 0 {

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            } for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                } long tmp=l; long tmp=l; tmp l tmp<=r tmp r tmp++ tmp++ tmp {
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                } {
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                } for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    } long tmp1=tmp+1; long tmp1=tmp+1; tmp1 tmp+1 tmp 1 tmp1<=r tmp1 r tmp1++ tmp1++ tmp1 {
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    } {
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    } long a = (tmp*tmp1) % 2019; a (tmp*tmp1) % 2019 (tmp*tmp1) tmp tmp1 2019 result = Math.min(a,result) result Math.min(a,result) Math.min Math a result System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    private static final int INF = 1000000007;
    private static final int INF1 = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();

        long result = INF1;
        if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        }

        System.out.println(result);

    }
} public class Main {

    private static final int INF = 1000000007;
    private static final int INF1 = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();

        long result = INF1;
        if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        }

        System.out.println(result);

    }
} Main

import java.util.*;


public class Main {

    private static final int INF = 1000000007;
    private static final int INF1 = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();

        long result = INF1;
        if((l <= 2019 && 2019 <= r)){
            result = 0;
        }else if(r < 2019) {
            result = (r*(r-1)) % 2019;
        } else if(l > 2019) {
            long waru = l / 2019;
            long warur = r / 2019;
            if(waru < warur){
                result = 0;
            }else{

                
                for(long tmp=l; tmp<=r; tmp++){
                    for(long tmp1=tmp+1; tmp1<=r;tmp1++){
                        long a = (tmp*tmp1) % 2019;
                        result = Math.min(a,result);
                    }
                }

            }

        }

        System.out.println(result);

    }
}
