import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	long mod = 2019;
	public void run() {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long ans = 1001001001;
		for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	long mod = 2019;
	public void run() {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long ans = 1001001001;
		for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} Main long mod = 2019; mod 2019 public static void main(String[] args) {
		Main main = new Main();
		main.run();
	} main {
		Main main = new Main();
		main.run();
	} Main main = new Main(); main new Main() main.run() main.run main String[] args args public void run() {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long ans = 1001001001;
		for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long ans = 1001001001;
		for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
		sc.close();
	} 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 long ans = 1001001001; ans 1001001001 for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		} long i=l+1; long i=l+1; i l+1 l 1 i<=Math.min(r, l+mod) i Math.min(r, l+mod) Math.min Math r l+mod l mod i++ i++ i {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		} {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		} for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			} long j=l; long j=l; j l j<i j i j++ j++ j {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			} {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			} long tmp = i*j; tmp i*j i j tmp %= mod tmp mod ans = Math.min(ans, tmp) ans Math.min(ans, tmp) Math.min Math ans tmp System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	long mod = 2019;
	public void run() {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long ans = 1001001001;
		for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	long mod = 2019;
	public void run() {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long ans = 1001001001;
		for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	long mod = 2019;
	public void run() {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();

		long ans = 1001001001;
		for(long i=l+1; i<=Math.min(r, l+mod); i++) {
			for(long j=l; j<i; j++) {
				long tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
		sc.close();
	}
}
