
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
	public static void main(String[] args) {
		
		FastReader sc = new FastReader();
	 long l = sc.nextLong();
	 long r = sc.nextLong();
	 if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 }	out.close();
		
	}
	
} import java.io.BufferedOutputStream; BufferedOutputStream java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
	public static void main(String[] args) {
		
		FastReader sc = new FastReader();
	 long l = sc.nextLong();
	 long r = sc.nextLong();
	 if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 }	out.close();
		
	}
	
} Main public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out)); out new PrintWriter (new BufferedOutputStream(System.out)) public static long mod = (long) (1e9+7); mod (long) (1e9+7) 1e9 7 public static void main(String[] args) {
		
		FastReader sc = new FastReader();
	 long l = sc.nextLong();
	 long r = sc.nextLong();
	 if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 }	out.close();
		
	} main {
		
		FastReader sc = new FastReader();
	 long l = sc.nextLong();
	 long r = sc.nextLong();
	 if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 }	out.close();
		
	} FastReader sc = new FastReader(); sc new FastReader() long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 } l<=2019 && r>=2019 l<=2019 l 2019 r>=2019 r 2019 out.println(0) out.println out 0 {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 } long min = ((l%2019)*(r%2019))%2019; min ((l%2019)*(r%2019))%2019 ((l%2019)*(r%2019)) (l%2019) l 2019 (r%2019) r 2019 2019 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 } long i=l; long i=l; i l i<=Math.min(l+2019, r) i Math.min(l+2019, r) Math.min Math l+2019 l 2019 r ++i ++i i {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 } {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 } for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 } long j=i+1; long j=i+1; j i+1 i 1 j<=Math.min(l+2019, r) j Math.min(l+2019, r) Math.min Math l+2019 l 2019 r ++j ++j j {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 } {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 } long temp = ((i%2019)*(j%2019))%2019; temp ((i%2019)*(j%2019))%2019 ((i%2019)*(j%2019)) (i%2019) i 2019 (j%2019) j 2019 2019 min = Math.min(min,temp) min Math.min(min,temp) Math.min Math min temp out.println(min) out.println out min out.close() out.close out String[] args args public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	} FastReader BufferedReader br; br StringTokenizer st; st public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		} FastReader {
			br = new BufferedReader(new InputStreamReader(System.in));
		} br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		} next {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		} while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			} st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			} try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				} catch (Exception r) {
					r.printStackTrace();
				} Exception r {
					r.printStackTrace();
				} r.printStackTrace() r.printStackTrace r {
					st = new StringTokenizer(br.readLine());
				} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		} nextInt {
			return Integer.parseInt(next());//converts string to integer
		} return Integer.parseInt(next());//converts string to integer Integer.parseInt(next()) Integer.parseInt Integer next() next double nextDouble() {
			return Double.parseDouble(next());
		} nextDouble {
			return Double.parseDouble(next());
		} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		} nextLine {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		} String str = ""; str "" try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			} catch (Exception r) {
				r.printStackTrace();
			} Exception r {
				r.printStackTrace();
			} r.printStackTrace() r.printStackTrace r {
				str = br.readLine();
			} str = br.readLine() str br.readLine() br.readLine br return str; str public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
	public static void main(String[] args) {
		
		FastReader sc = new FastReader();
	 long l = sc.nextLong();
	 long r = sc.nextLong();
	 if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 }	out.close();
		
	}
	
} public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
	public static void main(String[] args) {
		
		FastReader sc = new FastReader();
	 long l = sc.nextLong();
	 long r = sc.nextLong();
	 if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 }	out.close();
		
	}
	
} Main

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
	public static void main(String[] args) {
		
		FastReader sc = new FastReader();
	 long l = sc.nextLong();
	 long r = sc.nextLong();
	 if(l<=2019 && r>=2019) out.println(0);
	 else {

	
	 long min = ((l%2019)*(r%2019))%2019;
	 for(long i=l;i<=Math.min(l+2019, r);++i) {
		 for(long j=i+1;j<=Math.min(l+2019, r);++j) {
			 long temp = ((i%2019)*(j%2019))%2019;
			 min = Math.min(min,temp);
			
		 }
		 
	 }
	 out.println(min);
	 
	 }	out.close();
		
	}
	
}