import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		InputReader in = new InputReader();
		int l = in.nextInt();
		int r = in.nextInt();
		int n = r-l+1;
		if (n > 2020) {
			System.out.println(0);
			return;
		}
		int[] arr = new int[n];
		for (int i=l; i<=r; i++)
			arr[i-l] = i;
		long res = Long.MAX_VALUE;
		for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		}
		System.out.println(res);
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	
	public static void main(String[] args) {
		InputReader in = new InputReader();
		int l = in.nextInt();
		int r = in.nextInt();
		int n = r-l+1;
		if (n > 2020) {
			System.out.println(0);
			return;
		}
		int[] arr = new int[n];
		for (int i=l; i<=r; i++)
			arr[i-l] = i;
		long res = Long.MAX_VALUE;
		for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		}
		System.out.println(res);
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
} Main public static void main(String[] args) {
		InputReader in = new InputReader();
		int l = in.nextInt();
		int r = in.nextInt();
		int n = r-l+1;
		if (n > 2020) {
			System.out.println(0);
			return;
		}
		int[] arr = new int[n];
		for (int i=l; i<=r; i++)
			arr[i-l] = i;
		long res = Long.MAX_VALUE;
		for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		}
		System.out.println(res);
	} main {
		InputReader in = new InputReader();
		int l = in.nextInt();
		int r = in.nextInt();
		int n = r-l+1;
		if (n > 2020) {
			System.out.println(0);
			return;
		}
		int[] arr = new int[n];
		for (int i=l; i<=r; i++)
			arr[i-l] = i;
		long res = Long.MAX_VALUE;
		for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		}
		System.out.println(res);
	} InputReader in = new InputReader(); in new InputReader() int l = in.nextInt(); l in.nextInt() in.nextInt in int r = in.nextInt(); r in.nextInt() in.nextInt in int n = r-l+1; n r-l+1 r-l r l 1 if (n > 2020) {
			System.out.println(0);
			return;
		} n > 2020 n 2020 {
			System.out.println(0);
			return;
		} System.out.println(0) System.out.println System.out System System.out 0 return; int[] arr = new int[n]; arr new int[n] n for (int i=l; i<=r; i++)
			arr[i-l] = i; int i=l; int i=l; i l i<=r i r i++ i++ i arr[i-l] = i; arr[i-l] = i arr[i-l] arr i-l i l i long res = Long.MAX_VALUE; res Long.MAX_VALUE Long Long.MAX_VALUE for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		} int i=l; int i=l; i l i<r i r i++ i++ i {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		} {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		} for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			} int j=i+1; int j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
				res = Math.min(res, ((long)i*j)%2019);
			} {
				res = Math.min(res, ((long)i*j)%2019);
			} res = Math.min(res, ((long)i*j)%2019) res Math.min(res, ((long)i*j)%2019) Math.min Math res ((long)i*j)%2019 ((long)i*j) (long)i j 2019 System.out.println(res) System.out.println System.out System System.out res String[] args args static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	} InputReader public BufferedReader br; br public StringTokenizer st; st public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		} InputReader {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		} br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) st = null st null public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		} next {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		} while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			} st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			} try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				} catch (IOException e) {
					throw new RuntimeException(e);
				} IOException e {
					throw new RuntimeException(e);
				} throw new RuntimeException(e); new RuntimeException(e) {
					st = new StringTokenizer(br.readLine());
				} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st 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 class Main {
	
	public static void main(String[] args) {
		InputReader in = new InputReader();
		int l = in.nextInt();
		int r = in.nextInt();
		int n = r-l+1;
		if (n > 2020) {
			System.out.println(0);
			return;
		}
		int[] arr = new int[n];
		for (int i=l; i<=r; i++)
			arr[i-l] = i;
		long res = Long.MAX_VALUE;
		for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		}
		System.out.println(res);
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
} public class Main {
	
	public static void main(String[] args) {
		InputReader in = new InputReader();
		int l = in.nextInt();
		int r = in.nextInt();
		int n = r-l+1;
		if (n > 2020) {
			System.out.println(0);
			return;
		}
		int[] arr = new int[n];
		for (int i=l; i<=r; i++)
			arr[i-l] = i;
		long res = Long.MAX_VALUE;
		for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		}
		System.out.println(res);
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
} Main
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		InputReader in = new InputReader();
		int l = in.nextInt();
		int r = in.nextInt();
		int n = r-l+1;
		if (n > 2020) {
			System.out.println(0);
			return;
		}
		int[] arr = new int[n];
		for (int i=l; i<=r; i++)
			arr[i-l] = i;
		long res = Long.MAX_VALUE;
		for (int i=l; i<r; i++) {
			for (int j=i+1; j<=r; j++) {
				res = Math.min(res, ((long)i*j)%2019);
			}
		}
		System.out.println(res);
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}