import java.util.*;

public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		long l=Long.parseLong(scan.next());
		long r=Long.parseLong(scan.next());
		
		if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		}

}
}
//end import java.util.*; util.* java public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		long l=Long.parseLong(scan.next());
		long r=Long.parseLong(scan.next());
		
		if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		}

}
} Main public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		long l=Long.parseLong(scan.next());
		long r=Long.parseLong(scan.next());
		
		if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		}

} main {
		Scanner scan = new Scanner(System.in);
		long l=Long.parseLong(scan.next());
		long r=Long.parseLong(scan.next());
		
		if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		}

} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long l=Long.parseLong(scan.next()); l Long.parseLong(scan.next()) Long.parseLong Long scan.next() scan.next scan long r=Long.parseLong(scan.next()); r Long.parseLong(scan.next()) Long.parseLong Long scan.next() scan.next scan if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		} r-l>=2018 r-l r l 2018 {
			System.out.print(0);
		} System.out.print(0) System.out.print System.out System System.out 0 {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		} long min=2019; min 2019 for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			} long i = l; long i = l; i l i<r i r ++i ++i i {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			} {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			} for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				} long k=i+1; long k=i+1; k i+1 i 1 k<=r k r ++k ++k k {
					min=Math.min(min, (i*k)%2019);
				} {
					min=Math.min(min, (i*k)%2019);
				} min=Math.min(min, (i*k)%2019) min Math.min(min, (i*k)%2019) Math.min Math min (i*k)%2019 (i*k) i k 2019 System.out.print(min) System.out.print System.out System System.out min String[] args args public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		long l=Long.parseLong(scan.next());
		long r=Long.parseLong(scan.next());
		
		if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		}

}
} public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		long l=Long.parseLong(scan.next());
		long r=Long.parseLong(scan.next());
		
		if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		}

}
} Main
import java.util.*;

public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		long l=Long.parseLong(scan.next());
		long r=Long.parseLong(scan.next());
		
		if (r-l>=2018) {
			System.out.print(0);
		}else {
			long min=2019;
			for (long i = l;i<r;++i) {
				for (long k=i+1;k<=r;++k) {
					min=Math.min(min, (i*k)%2019);
				}
			}
			System.out.print(min);
		}

}
}
//end