import java.util.Scanner;

public class Main{
	static long a;
	static long b;
	static long x;
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();

		if(r - l > 2020) {
			r = l + 2020;
		}

		long ans = Long.MAX_VALUE;
		for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	static long a;
	static long b;
	static long x;
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();

		if(r - l > 2020) {
			r = l + 2020;
		}

		long ans = Long.MAX_VALUE;
		for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		}
		System.out.println(ans);
	}
} Main static long a; a static long b; b static long x; x public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();

		if(r - l > 2020) {
			r = l + 2020;
		}

		long ans = Long.MAX_VALUE;
		for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		}
		System.out.println(ans);
	} main {
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();

		if(r - l > 2020) {
			r = l + 2020;
		}

		long ans = Long.MAX_VALUE;
		for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		}
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long l = scan.nextLong(); l scan.nextLong() scan.nextLong scan long r = scan.nextLong(); r scan.nextLong() scan.nextLong scan if(r - l > 2020) {
			r = l + 2020;
		} r - l > 2020 r - l r l 2020 {
			r = l + 2020;
		} r = l + 2020 r l + 2020 l 2020 long ans = Long.MAX_VALUE; ans Long.MAX_VALUE Long Long.MAX_VALUE for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		} long i = l; long i = l; i l i <= r - 1 i r - 1 r 1 i++ i++ i {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		} {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		} for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			} {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			} if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				} ans > ((i % 2019) * j) % 2019 ans ((i % 2019) * j) % 2019 ((i % 2019) * j) (i % 2019) i 2019 j 2019 {
					ans = ((i % 2019) * j) % 2019;
				} ans = ((i % 2019) * j) % 2019 ans ((i % 2019) * j) % 2019 ((i % 2019) * j) (i % 2019) i 2019 j 2019 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	static long a;
	static long b;
	static long x;
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();

		if(r - l > 2020) {
			r = l + 2020;
		}

		long ans = Long.MAX_VALUE;
		for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		}
		System.out.println(ans);
	}
} public class Main{
	static long a;
	static long b;
	static long x;
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();

		if(r - l > 2020) {
			r = l + 2020;
		}

		long ans = Long.MAX_VALUE;
		for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main{
	static long a;
	static long b;
	static long x;
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();

		if(r - l > 2020) {
			r = l + 2020;
		}

		long ans = Long.MAX_VALUE;
		for(long i = l; i <= r - 1; i++) {
			for(long j = i + 1; j <= r; j++) {
				if(ans > ((i % 2019) * j) % 2019) {
					ans = ((i % 2019) * j) % 2019;
				}
			}
		}
		System.out.println(ans);
	}
}
