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



public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            int L=sc.nextInt();
            int R=sc.nextInt();
            int lShou= L/2019;
            int rShou= R/2019;
            int lJouyo=L%2019;
            int rJouyo=R%2019;
            int ans=INFTY;
            if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            }
            System.out.println(ans);
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            int L=sc.nextInt();
            int R=sc.nextInt();
            int lShou= L/2019;
            int rShou= R/2019;
            int lJouyo=L%2019;
            int rJouyo=R%2019;
            int ans=INFTY;
            if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            }
            System.out.println(ans);
    }
} Main static int INFTY=Integer.MAX_VALUE; INFTY Integer.MAX_VALUE Integer Integer.MAX_VALUE public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            int L=sc.nextInt();
            int R=sc.nextInt();
            int lShou= L/2019;
            int rShou= R/2019;
            int lJouyo=L%2019;
            int rJouyo=R%2019;
            int ans=INFTY;
            if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            }
            System.out.println(ans);
    } main {
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            int L=sc.nextInt();
            int R=sc.nextInt();
            int lShou= L/2019;
            int rShou= R/2019;
            int lJouyo=L%2019;
            int rJouyo=R%2019;
            int ans=INFTY;
            if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            }
            System.out.println(ans);
    } 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 lShou= L/2019; lShou L/2019 L 2019 int rShou= R/2019; rShou R/2019 R 2019 int lJouyo=L%2019; lJouyo L%2019 L 2019 int rJouyo=R%2019; rJouyo R%2019 R 2019 int ans=INFTY; ans INFTY if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            } lShou!=rShou lShou rShou {
                ans=0;
            } ans=0 ans 0 {
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            } for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                } int i=lJouyo; int i=lJouyo; i lJouyo i<rJouyo i rJouyo i++ i++ i {
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                } {
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                } for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    } int j=i+1; int j=i+1; j i+1 i 1 j<=rJouyo j rJouyo 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{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            int L=sc.nextInt();
            int R=sc.nextInt();
            int lShou= L/2019;
            int rShou= R/2019;
            int lJouyo=L%2019;
            int rJouyo=R%2019;
            int ans=INFTY;
            if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            }
            System.out.println(ans);
    }
} public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            int L=sc.nextInt();
            int R=sc.nextInt();
            int lShou= L/2019;
            int rShou= R/2019;
            int lJouyo=L%2019;
            int rJouyo=R%2019;
            int ans=INFTY;
            if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            }
            System.out.println(ans);
    }
} Main
import java.util.*;
import java.io.*;



public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            int L=sc.nextInt();
            int R=sc.nextInt();
            int lShou= L/2019;
            int rShou= R/2019;
            int lJouyo=L%2019;
            int rJouyo=R%2019;
            int ans=INFTY;
            if(lShou!=rShou){
                ans=0;
            }else{
                for(int i=lJouyo;i<rJouyo;i++){
                    for(int j=i+1;j<=rJouyo;j++){
                        ans=Math.min(ans,(i*j)%2019);
                    }
                }
            }
            System.out.println(ans);
    }
}