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

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();
		int R = sc.nextInt();

		sc.close();

//		R = Math.min(L + 2019, R);

		if(R-L > 3000) {
			out.println(0);
			return;
		}
		
		int ans = Integer.MAX_VALUE;
		for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();
		int R = sc.nextInt();

		sc.close();

//		R = Math.min(L + 2019, R);

		if(R-L > 3000) {
			out.println(0);
			return;
		}
		
		int ans = Integer.MAX_VALUE;
		for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} Main InputStream in = System.in; in System.in System System.in PrintStream out = System.out; out System.out System System.out public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();
		int R = sc.nextInt();

		sc.close();

//		R = Math.min(L + 2019, R);

		if(R-L > 3000) {
			out.println(0);
			return;
		}
		
		int ans = Integer.MAX_VALUE;
		for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		}
		out.println(ans);

	} _main {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();
		int R = sc.nextInt();

		sc.close();

//		R = Math.min(L + 2019, R);

		if(R-L > 3000) {
			out.println(0);
			return;
		}
		
		int ans = Integer.MAX_VALUE;
		for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		}
		out.println(ans);

	} Scanner sc = new Scanner(in); sc new Scanner(in) int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc sc.close() sc.close sc if(R-L > 3000) {
			out.println(0);
			return;
		} R-L > 3000 R-L R L 3000 {
			out.println(0);
			return;
		} out.println(0) out.println out 0 return; int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		} int x=L; int x=L; x L x<R x R x++ x++ x {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		} {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		} for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			} int y=x+1; int y=x+1; y x+1 x 1 y<=R y R y++ y++ y {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			} {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			} int m = (int)(((long)x * y) % 2019); m (int)(((long)x * y) % 2019) ((long)x * y) (long)x y 2019 ans = Math.min(ans, m) ans Math.min(ans, m) Math.min Math ans m out.println(ans) out.println out ans String[] args args public static void main(String[] args) {
		new Main()._main(args);
	} main {
		new Main()._main(args);
	} new Main()._main(args) new Main()._main new Main() args String[] args args public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();
		int R = sc.nextInt();

		sc.close();

//		R = Math.min(L + 2019, R);

		if(R-L > 3000) {
			out.println(0);
			return;
		}
		
		int ans = Integer.MAX_VALUE;
		for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();
		int R = sc.nextInt();

		sc.close();

//		R = Math.min(L + 2019, R);

		if(R-L > 3000) {
			out.println(0);
			return;
		}
		
		int ans = Integer.MAX_VALUE;
		for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();
		int R = sc.nextInt();

		sc.close();

//		R = Math.min(L + 2019, R);

		if(R-L > 3000) {
			out.println(0);
			return;
		}
		
		int ans = Integer.MAX_VALUE;
		for(int x=L;x<R;x++) {
			for(int y=x+1;y<=R;y++) {
//				if(x==y)continue;
				
				int m = (int)(((long)x * y) % 2019);
				ans = Math.min(ans, m);
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}
