import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		long l;
		long r;

		Scanner sc = new Scanner(System.in);

		l =  sc.nextInt();
		r =  sc.nextInt();

		long res;

		if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		}

		System.out.println(res);


	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		long l;
		long r;

		Scanner sc = new Scanner(System.in);

		l =  sc.nextInt();
		r =  sc.nextInt();

		long res;

		if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		}

		System.out.println(res);


	}
} Main public static void main(String[] args) {

		long l;
		long r;

		Scanner sc = new Scanner(System.in);

		l =  sc.nextInt();
		r =  sc.nextInt();

		long res;

		if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		}

		System.out.println(res);


	} main {

		long l;
		long r;

		Scanner sc = new Scanner(System.in);

		l =  sc.nextInt();
		r =  sc.nextInt();

		long res;

		if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		}

		System.out.println(res);


	} long l; l long r; r Scanner sc = new Scanner(System.in); sc new Scanner(System.in) l =  sc.nextInt() l sc.nextInt() sc.nextInt sc r =  sc.nextInt() r sc.nextInt() sc.nextInt sc long res; res if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		} r - l >= 2018 r - l r l 2018 {
			res = 0;
		} res = 0 res 0 {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		} res = 2018 res 2018 for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			} long i = l; long i = l; i l i < r i r i++ i++ i {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			} {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			} for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				} long j = i+1; long j = i+1; j i+1 i 1 j <= r j r ++j ++j j {
					res = Math.min(res, (i * j) % 2019);
				} {
					res = Math.min(res, (i * j) % 2019);
				} res = Math.min(res, (i * j) % 2019) res Math.min(res, (i * j) % 2019) Math.min Math res (i * j) % 2019 (i * j) i j 2019 System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
	public static void main(String[] args) {

		long l;
		long r;

		Scanner sc = new Scanner(System.in);

		l =  sc.nextInt();
		r =  sc.nextInt();

		long res;

		if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		}

		System.out.println(res);


	}
} public class Main {
	public static void main(String[] args) {

		long l;
		long r;

		Scanner sc = new Scanner(System.in);

		l =  sc.nextInt();
		r =  sc.nextInt();

		long res;

		if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		}

		System.out.println(res);


	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		long l;
		long r;

		Scanner sc = new Scanner(System.in);

		l =  sc.nextInt();
		r =  sc.nextInt();

		long res;

		if (r - l >= 2018) {
			res = 0;
		} else {

			res = 2018;

			for (long i = l; i < r; i++) {

				for (long j = i+1;j <= r; ++j) {
					res = Math.min(res, (i * j) % 2019);
				}

			}
		}

		System.out.println(res);


	}
}
