import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	}
} Main public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	} main {
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	} Scanner stdIn=new Scanner(System.in); stdIn new Scanner(System.in) long L=stdIn.nextLong(); L stdIn.nextLong() stdIn.nextLong stdIn long R=stdIn.nextLong(); R stdIn.nextLong() stdIn.nextLong stdIn long A[]=new long[2019]; A new long[2019] 2019 long min=2019 min 2019 z=L z L y=0; y 0 int x=0 x 0 w=0 w 0 v=0; v 0 while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		} z<=R z R {
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		} if(z==L)
				y=z%2019; z==L z L y=z%2019 y z%2019 z 2019 if(z!=L&&z%2019==y)
				break; z!=L&&z%2019==y z!=L z L z%2019==y z%2019 z 2019 y break; A[x]=z%2019 A[x] A x z%2019 z 2019 x++ x z++ z z=L z L while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		} w<x w x {
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		} v=w+1 v w+1 w 1 while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			} v<x v x {
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			} long c=(A[w]*A[v])%2019; c (A[w]*A[v])%2019 (A[w]*A[v]) A[w] A w A[v] A v 2019 if(c<min)
					min=c; c<min c min min=c min c v++ v w++ w System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	}
} public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	}
}