import java.io.IOException;
import java.util.*;

public class Main {
    public static int map[][]=new int[11][11];
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        System.out.println(ans);
    }


} import java.io.IOException; IOException java.io import java.util.*; util.* java public class Main {
    public static int map[][]=new int[11][11];
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        System.out.println(ans);
    }


} Main public static int map[][]=new int[11][11]; map new int[11][11] 11 11 public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        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 long diff=R-L; diff R-L R L long lmod=L%2019; lmod L%2019 L 2019 if(lmod+diff>=2019){
            System.out.println(0);
            return;
        } lmod+diff>=2019 lmod+diff lmod diff 2019 {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; long ans=999999; ans 999999 for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        } long i=L; long i=L; i L i<R i R i++ i++ i {
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        } {
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        } for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            } long j=i+1; long j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
                ans=Math.min(ans,i*j%2019);
            } {
                ans=Math.min(ans,i*j%2019);
            } ans=Math.min(ans,i*j%2019) ans Math.min(ans,i*j%2019) Math.min Math ans i*j%2019 i*j i j 2019 System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {
    public static int map[][]=new int[11][11];
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        System.out.println(ans);
    }


} public class Main {
    public static int map[][]=new int[11][11];
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        System.out.println(ans);
    }


} Main
import java.io.IOException;
import java.util.*;

public class Main {
    public static int map[][]=new int[11][11];
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        System.out.println(ans);
    }


}