import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		int l = sc.nextInt();
		int r = sc.nextInt();
		if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} import java.util.*; util.* java public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		int l = sc.nextInt();
		int r = sc.nextInt();
		if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int MOD = 1000000007; MOD 1000000007 final int MAX = Integer.MAX_VALUE; MAX Integer.MAX_VALUE Integer Integer.MAX_VALUE final long LMAX = Long.MAX_VALUE; LMAX Long.MAX_VALUE Long Long.MAX_VALUE final int LEN = 100000; LEN 100000 void doIt() {
		int l = sc.nextInt();
		int r = sc.nextInt();
		if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		}
	} doIt {
		int l = sc.nextInt();
		int r = sc.nextInt();
		if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		}
	} int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		} r - l > 2019 r - l r l 2019 {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		} long min = LMAX; min LMAX for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			} 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 > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			} {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			} for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				} {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				} if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					} min > (i * j) % 2019 min (i * j) % 2019 (i * j) i j 2019 {
						min = (i * j) % 2019;
					} min = (i * j) % 2019 min (i * j) % 2019 (i * j) i j 2019 System.out.println(min) System.out.println System.out System System.out min public static void main(String[] args) {
		new Main().doIt();
	} main {
		new Main().doIt();
	} new Main().doIt() new Main().doIt new Main() String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		int l = sc.nextInt();
		int r = sc.nextInt();
		if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		int l = sc.nextInt();
		int r = sc.nextInt();
		if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} Main
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		int l = sc.nextInt();
		int r = sc.nextInt();
		if(r - l > 2019) {
			System.out.println(0);
		}
		
		else {
			long min = LMAX;
			for(long i = l; i <= r; i++) {
				for(long j = i + 1; j <= r; j++) {
					if(min > (i * j) % 2019) {
						min = (i * j) % 2019;
					}
				}
			}
			System.out.println(min);
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}
