import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	}
} import java.util.*; util.* java import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; public class Main {
	public static void main(String[] args) {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	}
} Main public static void main(String[] args) {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	} main {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	} long i i j; j Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = parseInt(sc.next()); l parseInt(sc.next()) parseInt sc.next() sc.next sc int r = parseInt(sc.next()); r parseInt(sc.next()) parseInt sc.next() sc.next sc sc.close() sc.close sc long a; a int l2019 = l / 2019; l2019 l / 2019 l 2019 int r2019 = r / 2019; r2019 r / 2019 r 2019 if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		} l2019!=r2019 l2019 r2019 {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		} long min1 = 2000000000; min1 2000000000 for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			} i=l; i=l i l i<r i r i++ i++ i {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			} {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			} for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				} j=i+1; j=i+1 j i+1 i 1 j<=r j r j++ j++ j {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				} {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				} a = i*j % 2019 a i*j % 2019 i*j i j 2019 if(a < min1) {
						min1 = a;
					} a < min1 a min1 {
						min1 = a;
					} min1 = a min1 a System.out.println(min1) System.out.println System.out System System.out min1 String[] args args public class Main {
	public static void main(String[] args) {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	}
} public class Main {
	public static void main(String[] args) {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	}
} Main
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	}
}
