
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long l = sc.nextLong();
		long r = sc.nextLong();
		
		int l2 = (int) (l % 2019);
		int r2 = (int) (r % 2019);

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

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

		if(r - l > 2019) {
			System.out.println(0);
		}
		else if(l2 <= r2) {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		}else {
			System.out.println(0);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		
		long l = sc.nextLong();
		long r = sc.nextLong();
		
		int l2 = (int) (l % 2019);
		int r2 = (int) (r % 2019);

		if(r - l > 2019) {
			System.out.println(0);
		}
		else if(l2 <= r2) {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		}else {
			System.out.println(0);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc int l2 = (int) (l % 2019); l2 (int) (l % 2019) l 2019 int r2 = (int) (r % 2019); r2 (int) (r % 2019) r 2019 if(r - l > 2019) {
			System.out.println(0);
		}
		else if(l2 <= r2) {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		}else {
			System.out.println(0);
		} 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 if(l2 <= r2) {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		}else {
			System.out.println(0);
		} l2 <= r2 l2 r2 {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		} int min = l2 * r2 % 2019; min l2 * r2 % 2019 l2 * r2 l2 r2 2019 for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			} int i = l2; int i = l2; i l2 i <= r2 i r2 i++ i++ i {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			} {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			} for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				} int j = i+1; int j = i+1; j i+1 i 1 j <= r2 j r2 j++ j++ j {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				} {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				} int mod = i * j % 2019; mod i * j % 2019 i * j i j 2019 if(min > mod) {
						min = mod;
					} min > mod min mod {
						min = mod;
					} min = mod min mod System.out.println(min) System.out.println System.out System System.out min {
			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) {
		Scanner sc = new Scanner(System.in);
		
		long l = sc.nextLong();
		long r = sc.nextLong();
		
		int l2 = (int) (l % 2019);
		int r2 = (int) (r % 2019);

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

		if(r - l > 2019) {
			System.out.println(0);
		}
		else if(l2 <= r2) {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		}else {
			System.out.println(0);
		}
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long l = sc.nextLong();
		long r = sc.nextLong();
		
		int l2 = (int) (l % 2019);
		int r2 = (int) (r % 2019);

		if(r - l > 2019) {
			System.out.println(0);
		}
		else if(l2 <= r2) {
			int min = l2 * r2 % 2019;
			for (int i = l2; i <= r2; i++) {
				for (int j = i+1; j <= r2; j++) {
					int mod = i * j % 2019;
					if(min > mod) {
						min = mod;
					}
				}
			}
			System.out.println(min);
		}else {
			System.out.println(0);
		}
	}
}
