								//package Dynamic;
import java.io.*;
import java.util.*;
class Main 
{
    static public void main(String[] args) throws IOException 
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        //int t=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        int c=0;
        long l=Long.parseLong(st.nextToken());
        long r=Long.parseLong(st.nextToken());
        long aa=l%2019;
        long bb=r%2019;
        
        long val=l;
        long cc=l%2019;
        long min=99999l;
        //long m=99999;
        for(long xx=l+1;xx<=r;xx++)
        {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        }
        for(long x=l+1;x<r;x++)
        {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        }
        System.out.println(min);
        
        
        //long d=Long.parseLong(br.readLine());
//        while(st.hasMoreTokens())
//        {
//        	long aa=Long.parseLong(st.nextToken());
//        	
//        }
        //System.out.println((min*min2)%2019);
    }
} import java.io.*; io.* java import java.util.*; util.* java class Main 
{
    static public void main(String[] args) throws IOException 
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        //int t=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        int c=0;
        long l=Long.parseLong(st.nextToken());
        long r=Long.parseLong(st.nextToken());
        long aa=l%2019;
        long bb=r%2019;
        
        long val=l;
        long cc=l%2019;
        long min=99999l;
        //long m=99999;
        for(long xx=l+1;xx<=r;xx++)
        {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        }
        for(long x=l+1;x<r;x++)
        {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        }
        System.out.println(min);
        
        
        //long d=Long.parseLong(br.readLine());
//        while(st.hasMoreTokens())
//        {
//        	long aa=Long.parseLong(st.nextToken());
//        	
//        }
        //System.out.println((min*min2)%2019);
    }
} Main static public void main(String[] args) throws IOException 
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        //int t=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        int c=0;
        long l=Long.parseLong(st.nextToken());
        long r=Long.parseLong(st.nextToken());
        long aa=l%2019;
        long bb=r%2019;
        
        long val=l;
        long cc=l%2019;
        long min=99999l;
        //long m=99999;
        for(long xx=l+1;xx<=r;xx++)
        {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        }
        for(long x=l+1;x<r;x++)
        {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        }
        System.out.println(min);
        
        
        //long d=Long.parseLong(br.readLine());
//        while(st.hasMoreTokens())
//        {
//        	long aa=Long.parseLong(st.nextToken());
//        	
//        }
        //System.out.println((min*min2)%2019);
    } main {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        //int t=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        int c=0;
        long l=Long.parseLong(st.nextToken());
        long r=Long.parseLong(st.nextToken());
        long aa=l%2019;
        long bb=r%2019;
        
        long val=l;
        long cc=l%2019;
        long min=99999l;
        //long m=99999;
        for(long xx=l+1;xx<=r;xx++)
        {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        }
        for(long x=l+1;x<r;x++)
        {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        }
        System.out.println(min);
        
        
        //long d=Long.parseLong(br.readLine());
//        while(st.hasMoreTokens())
//        {
//        	long aa=Long.parseLong(st.nextToken());
//        	
//        }
        //System.out.println((min*min2)%2019);
    } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int c=0; c 0 long l=Long.parseLong(st.nextToken()); l Long.parseLong(st.nextToken()) Long.parseLong Long st.nextToken() st.nextToken st long r=Long.parseLong(st.nextToken()); r Long.parseLong(st.nextToken()) Long.parseLong Long st.nextToken() st.nextToken st long aa=l%2019; aa l%2019 l 2019 long bb=r%2019; bb r%2019 r 2019 long val=l; val l long cc=l%2019; cc l%2019 l 2019 long min=99999l; min 99999l for(long xx=l+1;xx<=r;xx++)
        {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        } long xx=l+1; long xx=l+1; xx l+1 l 1 xx<=r xx r xx++ xx++ xx {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        } {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        } min=Math.min(min,((l*xx)%2019l)) min Math.min(min,((l*xx)%2019l)) Math.min Math min ((l*xx)%2019l) (l*xx) l xx 2019l if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	} min==0 min 0 {
        		System.out.println("0");
        		System.exit(0);
        	} System.out.println("0") System.out.println System.out System System.out "0" System.exit(0) System.exit System 0 for(long x=l+1;x<r;x++)
        {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        } long x=l+1; long x=l+1; x l+1 l 1 x<r x r x++ x++ x {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        } {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        } for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            } long xx=x+1; long xx=x+1; xx x+1 x 1 xx<=r xx r xx++ xx++ xx {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            } {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            } min=Math.min(min,((x*xx)%2019l)) min Math.min(min,((x*xx)%2019l)) Math.min Math min ((x*xx)%2019l) (x*xx) x xx 2019l if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	} min==0 min 0 {
            		System.out.println("0");
            		System.exit(0);
            	} System.out.println("0") System.out.println System.out System System.out "0" System.exit(0) System.exit System 0 System.out.println(min) System.out.println System.out System System.out min String[] args args
								//package Dynamic;
import java.io.*;
import java.util.*;
class Main 
{
    static public void main(String[] args) throws IOException 
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        //int t=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        int c=0;
        long l=Long.parseLong(st.nextToken());
        long r=Long.parseLong(st.nextToken());
        long aa=l%2019;
        long bb=r%2019;
        
        long val=l;
        long cc=l%2019;
        long min=99999l;
        //long m=99999;
        for(long xx=l+1;xx<=r;xx++)
        {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        }
        for(long x=l+1;x<r;x++)
        {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        }
        System.out.println(min);
        
        
        //long d=Long.parseLong(br.readLine());
//        while(st.hasMoreTokens())
//        {
//        	long aa=Long.parseLong(st.nextToken());
//        	
//        }
        //System.out.println((min*min2)%2019);
    }
}