import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		sc.close();
		int mod = 2019;
		
		for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		}
		
		L%=mod;
		R%=mod;
		
		int ans = Integer.MAX_VALUE;
		for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		sc.close();
		int mod = 2019;
		
		for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		}
		
		L%=mod;
		R%=mod;
		
		int ans = Integer.MAX_VALUE;
		for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		sc.close();
		int mod = 2019;
		
		for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		}
		
		L%=mod;
		R%=mod;
		
		int ans = Integer.MAX_VALUE;
		for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		sc.close();
		int mod = 2019;
		
		for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		}
		
		L%=mod;
		R%=mod;
		
		int ans = Integer.MAX_VALUE;
		for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.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 int mod = 2019; mod 2019 for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		} int i=L; int i=L; i L i<=R i R i++ i++ i {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		} {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		} if(i%2019==0) {
				System.out.println(0);
				return;
			} i%2019==0 i%2019 i 2019 0 {
				System.out.println(0);
				return;
			} System.out.println(0) System.out.println System.out System System.out 0 return; L%=mod L mod R%=mod R mod int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		} int i=L; int i=L; i L i<R i R i++ i++ i {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		} {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		} for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			} int j=L+1; int j=L+1; j L+1 L 1 j<=R j R j++ j++ j {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			} {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			} int tmp = i*j; tmp i*j i j tmp %= mod tmp mod ans = Math.min(ans, tmp) ans Math.min(ans, tmp) Math.min Math 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) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		sc.close();
		int mod = 2019;
		
		for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		}
		
		L%=mod;
		R%=mod;
		
		int ans = Integer.MAX_VALUE;
		for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		sc.close();
		int mod = 2019;
		
		for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		}
		
		L%=mod;
		R%=mod;
		
		int ans = Integer.MAX_VALUE;
		for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		sc.close();
		int mod = 2019;
		
		for(int i=L;i<=R;i++) {
			if(i%2019==0) {
				System.out.println(0);
				return;
			}
		}
		
		L%=mod;
		R%=mod;
		
		int ans = Integer.MAX_VALUE;
		for(int i=L;i<R;i++) {
			for(int j=L+1;j<=R;j++) {
				int tmp = i*j;
				tmp %= mod;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
}