import java.util.*;
public class Main {
	public static void main(String args[] ){
		Scanner sc =new Scanner(System.in);
	long n = sc.nextLong();
	long m =sc.nextLong();
	long min  = 2018;
	
	
	if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		}
	
	
	System.out.println(min);
	
	
	}
} import java.util.*; util.* java public class Main {
	public static void main(String args[] ){
		Scanner sc =new Scanner(System.in);
	long n = sc.nextLong();
	long m =sc.nextLong();
	long min  = 2018;
	
	
	if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		}
	
	
	System.out.println(min);
	
	
	}
} Main public static void main(String args[] ){
		Scanner sc =new Scanner(System.in);
	long n = sc.nextLong();
	long m =sc.nextLong();
	long min  = 2018;
	
	
	if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		}
	
	
	System.out.println(min);
	
	
	} main {
		Scanner sc =new Scanner(System.in);
	long n = sc.nextLong();
	long m =sc.nextLong();
	long min  = 2018;
	
	
	if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		}
	
	
	System.out.println(min);
	
	
	} Scanner sc =new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc long m =sc.nextLong(); m sc.nextLong() sc.nextLong sc long min  = 2018; min 2018 if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		} m*m<2019 m*m m m 2019 {
		long data =(n*(n+1))%2019;
		min =data;
	} long data =(n*(n+1))%2019; data (n*(n+1))%2019 (n*(n+1)) n (n+1) n 1 2019 min =data min data {
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		} for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		} long i=n; long i=n; i n i<m i m i++ i++ i {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		} {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		} for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			} long j=i+1; long j=i+1; j i+1 i 1 j<=m j m j++ j++ j {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			} {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			} long data =(i*j)%2019; data (i*j)%2019 (i*j) i j 2019 if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				} min > data min data {
					//System.out.println(i+" "+j);
					min =data;
				} min =data min data if(min==0) break; min==0 min 0 break; if(min==0) break; min==0 min 0 break; 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[] ){
		Scanner sc =new Scanner(System.in);
	long n = sc.nextLong();
	long m =sc.nextLong();
	long min  = 2018;
	
	
	if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		}
	
	
	System.out.println(min);
	
	
	}
} public class Main {
	public static void main(String args[] ){
		Scanner sc =new Scanner(System.in);
	long n = sc.nextLong();
	long m =sc.nextLong();
	long min  = 2018;
	
	
	if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		}
	
	
	System.out.println(min);
	
	
	}
} Main
import java.util.*;
public class Main {
	public static void main(String args[] ){
		Scanner sc =new Scanner(System.in);
	long n = sc.nextLong();
	long m =sc.nextLong();
	long min  = 2018;
	
	
	if(m*m<2019) {
		long data =(n*(n+1))%2019;
		min =data;
	}else{
		for(long i=n;i<m;i++) {
			for(long j=i+1;j<=m;j++) {
				long data =(i*j)%2019;
				if(min > data) {
					//System.out.println(i+" "+j);
					min =data;
				}
				if(min==0) break;
				
				
			}
			if(min==0) break;
		}
		}
	
	
	System.out.println(min);
	
	
	}
}
