import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long L  = keyboard.nextLong();
		long R  = keyboard.nextLong();
		long x = 2019;
		
		if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		}
		keyboard.close();	
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long L  = keyboard.nextLong();
		long R  = keyboard.nextLong();
		long x = 2019;
		
		if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		}
		keyboard.close();	
	}
} Main public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long L  = keyboard.nextLong();
		long R  = keyboard.nextLong();
		long x = 2019;
		
		if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		}
		keyboard.close();	
	} main {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long L  = keyboard.nextLong();
		long R  = keyboard.nextLong();
		long x = 2019;
		
		if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		}
		keyboard.close();	
	} Scanner keyboard = new Scanner(System.in); keyboard new Scanner(System.in) long L  = keyboard.nextLong(); L keyboard.nextLong() keyboard.nextLong keyboard long R  = keyboard.nextLong(); R keyboard.nextLong() keyboard.nextLong keyboard long x = 2019; x 2019 if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		} R-L>=2018 R-L R L 2018 {
			System.out.print(0);
		} System.out.print(0) System.out.print System.out System System.out 0 {
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		} for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			} long i = L; long i = L; i L i <=R i R i++ i++ i {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			} {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			} for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				} long j = i+1; long j = i+1; j i+1 i 1 j <=R j R j++ j++ j {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				} {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				} Long amari = (i*j) % 2019; amari (i*j) % 2019 (i*j) i j 2019 x = (amari<=x)? amari:x x (amari<=x)? amari:x (amari<=x) amari x amari x System.out.print(x) System.out.print System.out System System.out x keyboard.close() keyboard.close keyboard String[] args args public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long L  = keyboard.nextLong();
		long R  = keyboard.nextLong();
		long x = 2019;
		
		if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		}
		keyboard.close();	
	}
} public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long L  = keyboard.nextLong();
		long R  = keyboard.nextLong();
		long x = 2019;
		
		if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		}
		keyboard.close();	
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long L  = keyboard.nextLong();
		long R  = keyboard.nextLong();
		long x = 2019;
		
		if(R-L>=2018) {
			System.out.print(0);
		}else{
			for(long i = L; i <=R; i++) {
				for(long j = i+1; j <=R; j++) {
					Long amari = (i*j) % 2019;
					x = (amari<=x)? amari:x ;
				}
			}
			System.out.print(x);
		}
		keyboard.close();	
	}
}
