
import java.util.Scanner;
public class Main {
	static int mod = 1000000007;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}
} import java.util.Scanner; Scanner java.util public class Main {
	static int mod = 1000000007;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}
} Main static int mod = 1000000007; mod 1000000007 public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	} main {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long m = sc.nextInt(); m sc.nextInt() sc.nextInt sc long ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
	static int mod = 1000000007;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}
} public class Main {
	static int mod = 1000000007;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}
} Main

import java.util.Scanner;
public class Main {
	static int mod = 1000000007;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}
}
