import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 2019L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}
	void solve() {
		long L = nextLong();
		long R = nextLong();
		if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		}

		long min = Mod;
		for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		}
		out.println(min);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

} import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 2019L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}
	void solve() {
		long L = nextLong();
		long R = nextLong();
		if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		}

		long min = Mod;
		for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		}
		out.println(min);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

} Main static final PrintStream out = System.out; out System.out System System.out static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static final long Mod = 2019L; Mod 2019L public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	} main {
		Main main = new Main();
		main.solve();
		System.exit(0);
	} Main main = new Main(); main new Main() main.solve() main.solve main System.exit(0) System.exit System 0 String[] args args void solve() {
		long L = nextLong();
		long R = nextLong();
		if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		}

		long min = Mod;
		for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		}
		out.println(min);
	} solve {
		long L = nextLong();
		long R = nextLong();
		if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		}

		long min = Mod;
		for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		}
		out.println(min);
	} long L = nextLong(); L nextLong() nextLong long R = nextLong(); R nextLong() nextLong if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		} L <= Mod && Mod <= R || R - L >= Mod L <= Mod && Mod <= R L <= Mod L Mod Mod <= R Mod R R - L >= Mod R - L R L Mod {
			out.println(0);
			return;
		} out.println(0) out.println out 0 return; long min = Mod; min Mod for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		} long i=L; long i=L; i L i<R i R i++ i++ i {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		} {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		} for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			} long j=i+1; long j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
				min = Math.min(i*j%Mod,min);
			} {
				min = Math.min(i*j%Mod,min);
			} min = Math.min(i*j%Mod,min) min Math.min(i*j%Mod,min) Math.min Math i*j%Mod i*j i j Mod min out.println(min) out.println out min public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	} nextIntArray {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	} int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++)a[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextInt(); a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	} nextLongArray {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	} long[] a = new long[n]; a new long[n] n for (int i = 0; i < n; i++)a[i] = nextLong(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextLong(); a[i] = nextLong() a[i] a i nextLong() nextLong return a; a int n n public int nextInt() {
		return Integer.parseInt(next());
	} nextInt {
		return Integer.parseInt(next());
	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
		return Long.parseLong(next());
	} nextLong {
		return Long.parseLong(next());
	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public String next() {
		return sc.next();
	} next {
		return sc.next();
	} return sc.next(); sc.next() sc.next sc public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 2019L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}
	void solve() {
		long L = nextLong();
		long R = nextLong();
		if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		}

		long min = Mod;
		for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		}
		out.println(min);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

} public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 2019L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}
	void solve() {
		long L = nextLong();
		long R = nextLong();
		if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		}

		long min = Mod;
		for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		}
		out.println(min);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

} Main
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 2019L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}
	void solve() {
		long L = nextLong();
		long R = nextLong();
		if(L <= Mod && Mod <= R || R - L >= Mod) {
			out.println(0);
			return;
		}

		long min = Mod;
		for(long i=L;i<R;i++) {
			for(long j=i+1;j<=R;j++) {
				min = Math.min(i*j%Mod,min);
			}
		}
		out.println(min);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

}