import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int left = sc.nextInt();
        int right = sc.nextInt();
        right -= left;
        left = left % 2019;
        right += left;

        int ans = 2020;
        int rightLimit = Math.min(left+2018, right);
        for(int i = left; i <= rightLimit; i++){
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int left = sc.nextInt();
        int right = sc.nextInt();
        right -= left;
        left = left % 2019;
        right += left;

        int ans = 2020;
        int rightLimit = Math.min(left+2018, right);
        for(int i = left; i <= rightLimit; i++){
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int left = sc.nextInt();
        int right = sc.nextInt();
        right -= left;
        left = left % 2019;
        right += left;

        int ans = 2020;
        int rightLimit = Math.min(left+2018, right);
        for(int i = left; i <= rightLimit; i++){
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int left = sc.nextInt();
        int right = sc.nextInt();
        right -= left;
        left = left % 2019;
        right += left;

        int ans = 2020;
        int rightLimit = Math.min(left+2018, right);
        for(int i = left; i <= rightLimit; i++){
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int left = sc.nextInt(); left sc.nextInt() sc.nextInt sc int right = sc.nextInt(); right sc.nextInt() sc.nextInt sc right -= left right left left = left % 2019 left left % 2019 left 2019 right += left right left int ans = 2020; ans 2020 int rightLimit = Math.min(left+2018, right); rightLimit Math.min(left+2018, right) Math.min Math left+2018 left 2018 right for(int i = left; i <= rightLimit; i++){
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        } int i = left; int i = left; i left i <= rightLimit i rightLimit i++ i++ i {
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        } {
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        } for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            } int j = i+1; int j = i+1; j i+1 i 1 j <= rightLimit j rightLimit j++ j++ j {
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            } {
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            } int num = (i * j) % 2019; num (i * j) % 2019 (i * j) i j 2019 ans = Math.min(ans, num) ans Math.min(ans, num) Math.min Math ans num System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int left = sc.nextInt();
        int right = sc.nextInt();
        right -= left;
        left = left % 2019;
        right += left;

        int ans = 2020;
        int rightLimit = Math.min(left+2018, right);
        for(int i = left; i <= rightLimit; i++){
            for(int j = i+1; j <= rightLimit; j++){
                int num = (i * j) % 2019;
                ans = Math.min(ans, num);
            }
        }
        System.out.println(ans);
    }
}