import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}
		
		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);		
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}
		
		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);		
	}
} Main public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}
		
		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);		
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}
		
		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);		
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line; line String in[] = new String[2]; in new String[2] 2 long l = 0 l 0 r = 0; r 0 try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		} catch (IOException e) {
			e.getStackTrace();
		} IOException e {
			e.getStackTrace();
		} e.getStackTrace() e.getStackTrace e {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} line = br.readLine() line br.readLine() br.readLine br in = line.split(" ") in line.split(" ") line.split line " " l = Long.parseLong(in[0]) l Long.parseLong(in[0]) Long.parseLong Long in[0] in 0 r = Long.parseLong(in[1]) r Long.parseLong(in[1]) Long.parseLong Long in[1] in 1 int min = 2020; min 2020 int mod; mod for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		} long i = l; long i = l; i l i < r i r i++ i++ i {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		} {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		} for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			} long j = i+1; long j = i+1; j i+1 i 1 j <= r j r j++ j++ j {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			} {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			} if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				} min > (mod =(int) ((i*j) % 2019)) min (mod =(int) ((i*j) % 2019)) mod (int) ((i*j) % 2019) (i*j) i j 2019 {
					min = mod;
					if(min == 0) break;
				} min = mod min mod 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) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}
		
		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);		
	}
} public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}
		
		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);		
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}
		
		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);		
	}
}