import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			long min = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			long min = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			long min = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			long min = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() 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 = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			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 = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		} long min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE long a; a for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			} int i = l; int i = l; i l i < r i r i++ i++ i {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			} {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			} for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				} int j = l + 1; int j = l + 1; j l + 1 l 1 j <= r j r j++ j++ j {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				} {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				} a = ((long) i * j) % 2019 a ((long) i * j) % 2019 ((long) i * j) (long) i j 2019 min = Math.min(min, a) min Math.min(min, a) Math.min Math min a 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) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			long min = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			long min = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			long min = Integer.MAX_VALUE;
			long a;
			for (int i = l; i < r; i++) {
				for (int j = l + 1; j <= r; j++) {
					a = ((long) i * j) % 2019;
					min = Math.min(min, a);
				}
			}
			System.out.println(min);
		}
	}
}
