import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();

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

		if(r-l+1 >= 2019) {
			System.out.println("0");
			return;
		}
		long ans = 2019;
		for(long i=l; i<r; i++) {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();

		if(r-l+1 >= 2019) {
			System.out.println("0");
			return;
		}
		long ans = 2019;
		for(long i=l; i<r; i++) {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();

		if(r-l+1 >= 2019) {
			System.out.println("0");
			return;
		}
		long ans = 2019;
		for(long i=l; i<r; i++) {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextInt(); l sc.nextInt() sc.nextInt sc long r = sc.nextInt(); r sc.nextInt() sc.nextInt sc if(r-l+1 >= 2019) {
			System.out.println("0");
			return;
		} r-l+1 >= 2019 r-l+1 r-l r l 1 2019 {
			System.out.println("0");
			return;
		} System.out.println("0") System.out.println System.out System System.out "0" return; long ans = 2019; ans 2019 for(long i=l; i<r; i++) {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		} long i=l; long i=l; i l i<r i r i++ i++ i {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		} {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		} for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			} long j=i+1; long j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			} {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			} long tmp = (i*j)%2019; tmp (i*j)%2019 (i*j) i j 2019 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);
		long l = sc.nextInt();
		long r = sc.nextInt();

		if(r-l+1 >= 2019) {
			System.out.println("0");
			return;
		}
		long ans = 2019;
		for(long i=l; i<r; i++) {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();

		if(r-l+1 >= 2019) {
			System.out.println("0");
			return;
		}
		long ans = 2019;
		for(long i=l; i<r; i++) {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();

		if(r-l+1 >= 2019) {
			System.out.println("0");
			return;
		}
		long ans = 2019;
		for(long i=l; i<r; i++) {
			for(long j=i+1; j<=r; j++) {
				long tmp = (i*j)%2019;
				ans = Math.min(ans, tmp);
			}
		}
		System.out.println(ans);
	}
}
