import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] D = W.split(" ");
		int MOD = 2019;

		long L = Long.parseLong(D[0]);
		long R = Long.parseLong(D[1]);

		long ed = R<L+MOD?R:L+MOD;
		long i = L;

		long ans = MOD;
		for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		}

		System.out.println(ans);

	}


} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] D = W.split(" ");
		int MOD = 2019;

		long L = Long.parseLong(D[0]);
		long R = Long.parseLong(D[1]);

		long ed = R<L+MOD?R:L+MOD;
		long i = L;

		long ans = MOD;
		for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		}

		System.out.println(ans);

	}


} Main public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] D = W.split(" ");
		int MOD = 2019;

		long L = Long.parseLong(D[0]);
		long R = Long.parseLong(D[1]);

		long ed = R<L+MOD?R:L+MOD;
		long i = L;

		long ans = MOD;
		for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		}

		System.out.println(ans);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] D = W.split(" ");
		int MOD = 2019;

		long L = Long.parseLong(D[0]);
		long R = Long.parseLong(D[1]);

		long ed = R<L+MOD?R:L+MOD;
		long i = L;

		long ans = MOD;
		for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		}

		System.out.println(ans);

	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String W = in.readLine(); W in.readLine() in.readLine in String[] D = W.split(" "); D W.split(" ") W.split W " " int MOD = 2019; MOD 2019 long L = Long.parseLong(D[0]); L Long.parseLong(D[0]) Long.parseLong Long D[0] D 0 long R = Long.parseLong(D[1]); R Long.parseLong(D[1]) Long.parseLong Long D[1] D 1 long ed = R<L+MOD?R:L+MOD; ed R<L+MOD?R:L+MOD R<L+MOD R L+MOD L MOD R L+MOD L MOD long i = L; i L long ans = MOD; ans MOD for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		} ; i<ed i ed i++ i++ i {
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		} {
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		} for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			} long k=i+1; long k=i+1; k i+1 i 1 k<=ed k ed k++ k++ k {
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			} {
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			} long tmp = Long.remainderUnsigned(i*k, MOD); tmp Long.remainderUnsigned(i*k, MOD) Long.remainderUnsigned Long i*k i k MOD if(tmp < ans ){
					ans = tmp;
				} tmp < ans tmp ans {
					ans = tmp;
				} ans = tmp ans tmp System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] D = W.split(" ");
		int MOD = 2019;

		long L = Long.parseLong(D[0]);
		long R = Long.parseLong(D[1]);

		long ed = R<L+MOD?R:L+MOD;
		long i = L;

		long ans = MOD;
		for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		}

		System.out.println(ans);

	}


} public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] D = W.split(" ");
		int MOD = 2019;

		long L = Long.parseLong(D[0]);
		long R = Long.parseLong(D[1]);

		long ed = R<L+MOD?R:L+MOD;
		long i = L;

		long ans = MOD;
		for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		}

		System.out.println(ans);

	}


} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] D = W.split(" ");
		int MOD = 2019;

		long L = Long.parseLong(D[0]);
		long R = Long.parseLong(D[1]);

		long ed = R<L+MOD?R:L+MOD;
		long i = L;

		long ans = MOD;
		for(;i<ed;i++){
			for(long k=i+1;k<=ed;k++){
				long tmp = Long.remainderUnsigned(i*k, MOD);
				if(tmp < ans ){
					ans = tmp;
				}
			}
		}

		System.out.println(ans);

	}


}
