import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),r=sc.nextInt();
		sc.close();
		if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),r=sc.nextInt();
		sc.close();
		if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),r=sc.nextInt();
		sc.close();
		if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		}
	} main {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),r=sc.nextInt();
		sc.close();
		if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		}
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int l=sc.nextInt() l sc.nextInt() sc.nextInt sc r=sc.nextInt(); r sc.nextInt() sc.nextInt sc sc.close() sc.close sc if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		} r-l>=2018 r-l r l 2018 System.out.println(0) System.out.println System.out System System.out 0 {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		} long min=2018; min 2018 for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			} int i=l; int i=l; i l i<r i r i++ i++ i {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			} {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			} for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				} int j=i+1; int j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				} {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				} long temp =(long)i*j; temp (long)i*j (long)i j long mod = temp%2019; mod temp%2019 temp 2019 if(mod<min) min=mod; mod<min mod min min=mod min mod System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),r=sc.nextInt();
		sc.close();
		if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),r=sc.nextInt();
		sc.close();
		if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),r=sc.nextInt();
		sc.close();
		if(r-l>=2018) System.out.println(0);
		else {
			long min=2018;
			for(int i=l;i<r;i++) {
				for(int j=i+1;j<=r;j++) {
					long temp =(long)i*j;
					long mod = temp%2019;
					if(mod<min) min=mod;
				}
			}
			System.out.println(min);
		}
	}
}