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();
        long opt=2019;
        if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        }
        System.out.println(opt);
    }
} 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();
        long opt=2019;
        if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        }
        System.out.println(opt);
    }
} Main public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();
        long opt=2019;
        if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        }
        System.out.println(opt);
    } main {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();
        long opt=2019;
        if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        }
        System.out.println(opt);
    } 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 long opt=2019; opt 2019 if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        } L==0||R-L>=2019 L==0 L 0 R-L>=2019 R-L R L 2019 opt=0 opt 0 {
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        } for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            } long i=L; long i=L; i L i<R i R i++ i++ i {
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            } {
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            } for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                } long j=i+1; long j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                } {
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                } long num = (i*j)%2019; num (i*j)%2019 (i*j) i j 2019 if(opt>num) opt=num; opt>num opt num opt=num opt num System.out.println(opt) System.out.println System.out System System.out opt 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();
        long opt=2019;
        if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        }
        System.out.println(opt);
    }
} public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();
        long opt=2019;
        if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        }
        System.out.println(opt);
    }
} 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();
        long opt=2019;
        if(L==0||R-L>=2019) opt=0;
        else{
            for(long i=L;i<R;i++){
                for(long j=i+1;j<=R;j++){
                    long num = (i*j)%2019;
                    if(opt>num) opt=num;
                }
            }
        }
        System.out.println(opt);
    }
}
