import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		new ABC133().c();
	}
}

class ABC133{
		void c(){
				long L, R;
				long M = 2019L;
				Scanner in = new Scanner(System.in);
				L = in.nextLong();
				R = in.nextLong();
				int ans = 2018;
				long maxI = (long)Math.min(R, L+M);
				for(long i=L; i<=maxI; ++i){
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				}
				System.out.println(ans);
				in.close();
		}
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
	public static void main(String[] args) throws IOException {
		new ABC133().c();
	}
} Main public static void main(String[] args) throws IOException {
		new ABC133().c();
	} main {
		new ABC133().c();
	} new ABC133().c() new ABC133().c new ABC133() String[] args args class ABC133{
		void c(){
				long L, R;
				long M = 2019L;
				Scanner in = new Scanner(System.in);
				L = in.nextLong();
				R = in.nextLong();
				int ans = 2018;
				long maxI = (long)Math.min(R, L+M);
				for(long i=L; i<=maxI; ++i){
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				}
				System.out.println(ans);
				in.close();
		}
} ABC133 void c(){
				long L, R;
				long M = 2019L;
				Scanner in = new Scanner(System.in);
				L = in.nextLong();
				R = in.nextLong();
				int ans = 2018;
				long maxI = (long)Math.min(R, L+M);
				for(long i=L; i<=maxI; ++i){
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				}
				System.out.println(ans);
				in.close();
		} c {
				long L, R;
				long M = 2019L;
				Scanner in = new Scanner(System.in);
				L = in.nextLong();
				R = in.nextLong();
				int ans = 2018;
				long maxI = (long)Math.min(R, L+M);
				for(long i=L; i<=maxI; ++i){
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				}
				System.out.println(ans);
				in.close();
		} long L L R; R long M = 2019L; M 2019L Scanner in = new Scanner(System.in); in new Scanner(System.in) L = in.nextLong() L in.nextLong() in.nextLong in R = in.nextLong() R in.nextLong() in.nextLong in int ans = 2018; ans 2018 long maxI = (long)Math.min(R, L+M); maxI (long)Math.min(R, L+M) Math.min Math R L+M L M for(long i=L; i<=maxI; ++i){
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				} long i=L; long i=L; i L i<=maxI i maxI ++i ++i i {
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				} {
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				} long maxJ = (long)Math.min(R, i+1L+M); maxJ (long)Math.min(R, i+1L+M) Math.min Math R i+1L+M i+1L+M i 1L M for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						} long j=i+1; long j=i+1; j i+1 i 1 j<=maxJ j maxJ ++j ++j j {
								ans = (int)Math.min(ans, i*j%M);
						} {
								ans = (int)Math.min(ans, i*j%M);
						} ans = (int)Math.min(ans, i*j%M) ans (int)Math.min(ans, i*j%M) Math.min Math ans i*j%M i*j i j M System.out.println(ans) System.out.println System.out System System.out ans in.close() in.close in public class Main {
	public static void main(String[] args) throws IOException {
		new ABC133().c();
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		new ABC133().c();
	}
} Main
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		new ABC133().c();
	}
}

class ABC133{
		void c(){
				long L, R;
				long M = 2019L;
				Scanner in = new Scanner(System.in);
				L = in.nextLong();
				R = in.nextLong();
				int ans = 2018;
				long maxI = (long)Math.min(R, L+M);
				for(long i=L; i<=maxI; ++i){
						long maxJ = (long)Math.min(R, i+1L+M);
						for(long j=i+1; j<=maxJ; ++j){
								ans = (int)Math.min(ans, i*j%M);
						}
				}
				System.out.println(ans);
				in.close();
		}
}
