import java.util.Scanner;
 
public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    }
} Main static Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) public static void main(String[] args){
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    } main {
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    } int l = stdIn.nextInt(); l stdIn.nextInt() stdIn.nextInt stdIn int r = stdIn.nextInt(); r stdIn.nextInt() stdIn.nextInt stdIn int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        } int i=l; int i=l; i l (i<=r-1 && i<l+2019) i<=r-1 i r-1 r 1 i<l+2019 i l+2019 l 2019 i++ i++ i {
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        } {
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        } for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            } int j=i+1; int j=i+1; j i+1 i 1 (j<=r && j<i+2020) j<=r j r j<i+2020 j i+2020 i 2020 j++ j++ j {
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            } {
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            } if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                } ((long)i*j) % 2019 < min ((long)i*j) % 2019 ((long)i*j) (long)i j 2019 min {
                    min = (int)(((long)i*j) % 2019);
                } min = (int)(((long)i*j) % 2019) min (int)(((long)i*j) % 2019) ((long)i*j) (long)i j 2019 System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    }
} public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    }
} Main
import java.util.Scanner;
 
public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int l = stdIn.nextInt();
        int r = stdIn.nextInt();
 
        int min = Integer.MAX_VALUE;
        for(int i=l; (i<=r-1 && i<l+2019); i++){
            for(int j=i+1; (j<=r && j<i+2020); j++){
                if(((long)i*j) % 2019 < min){
                    min = (int)(((long)i*j) % 2019);
                }
            }
        }
 
        System.out.println(min);
    }
}