import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		}
		
		
	}
		
	

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		}
		
		
	}
		
	

} Main public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		}
		
		
	} main {
		try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		}
		
		
	} try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		} {
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		} Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) final int MOD = 2019; MOD 2019 int L = scan.nextInt(); L scan.nextInt() scan.nextInt scan int R = scan.nextInt(); R scan.nextInt() scan.nextInt scan if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			} L/MOD==R/MOD L/MOD L MOD R/MOD R MOD {
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			} int start = L%MOD; start L%MOD L MOD int last = R%MOD; last R%MOD R MOD int minmod = 2018; minmod 2018 for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				} int i =start; int i =start; i start i<=last-1 i last-1 last 1 i++ i++ i {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				} {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				} for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					} int j = start+1; int j = start+1; j start+1 start 1 j<=last j last j++ j++ j {
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					} {
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					} int c = i*j%MOD; c i*j%MOD i*j i j MOD if(minmod>c) {
							minmod=c;
						} minmod>c minmod c {
							minmod=c;
						} minmod=c minmod c System.out.println(minmod) System.out.println System.out System System.out minmod {
				
				
				System.out.println(0);
			} System.out.println(0) System.out.println System.out System System.out 0 String[]args args public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		}
		
		
	}
		
	

} public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		}
		
		
	}
		
	

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			final int MOD = 2019;
			
			int L = scan.nextInt();
			int R = scan.nextInt();
			
			if(L/MOD==R/MOD){
				int start = L%MOD;
				int last = R%MOD;
				int minmod = 2018;
				
				for(int i =start;i<=last-1;i++) {
					for(int j = start+1;j<=last;j++){
						int c = i*j%MOD;
						if(minmod>c) {
							minmod=c;
						}
						
					}
				}
				
				
				System.out.println(minmod);
				
				
				
			}else{
				
				
				System.out.println(0);
			}
			
			
		}
		
		
	}
		
	

}
