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();
        int ans = 0; 
    //処理
        if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        }
    System.out.println(ans);
        sc.close();

    }
} 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();
        int ans = 0; 
    //処理
        if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        }
    System.out.println(ans);
        sc.close();

    }
} Main public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();
        int ans = 0; 
    //処理
        if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        }
    System.out.println(ans);
        sc.close();

    } main {
    //入力
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();
        int ans = 0; 
    //処理
        if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        }
    System.out.println(ans);
        sc.close();

    } 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 int ans = 0; ans 0 if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        } R - L >= 2019 R - L R L 2019 {
            ans = 0;
        } ans = 0 ans 0 {
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        } R = R % 2019 R R % 2019 R 2019 L = L % 2019 L L % 2019 L 2019 int temp = R*L % 2019; temp R*L % 2019 R*L R L 2019 for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } int i = L; int i = L; i L i<=R-1 i R-1 R 1 i++ i++ i {
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } {
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                } int j= i+1; int j= i+1; j i+1 i 1 j<=R j R j++ j++ j {
                    temp = Math.min(i*j%2019,temp);
                } {
                    temp = Math.min(i*j%2019,temp);
                } temp = Math.min(i*j%2019,temp) temp Math.min(i*j%2019,temp) Math.min Math i*j%2019 i*j i j 2019 temp ans = temp ans temp System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc 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();
        int ans = 0; 
    //処理
        if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        }
    System.out.println(ans);
        sc.close();

    }
} public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();
        int ans = 0; 
    //処理
        if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        }
    System.out.println(ans);
        sc.close();

    }
} 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();
        int ans = 0; 
    //処理
        if(R - L >= 2019){
            ans = 0;
        }
        else{
            R = R % 2019;
            L = L % 2019;
            int temp = R*L % 2019;
            for(int i = L;i<=R-1;i++){
                for(int j= i+1;j<=R;j++){
                    temp = Math.min(i*j%2019,temp);
                }
            } 
            ans = temp;
        }
    System.out.println(ans);
        sc.close();

    }
}