import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		// input
		long left = scan.nextLong();
		long right = scan.nextLong();

		// check
		long min = Long.MAX_VALUE;
		fin: for(long i = left; i < right; i++) {
			for(long j = i + 1; j <= right; j++) {
				if(i * j % 2019 < min) {
					min = i * j % 2019;
				}
				if(j % 2019 == 0 || i % 2019 == 0) {
					min = 0;
					break fin;
				}
			}
		}

		System.out.println(min);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {


	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		// input
		long left = scan.nextLong();
		long right = scan.nextLong();

		// check
		long min = Long.MAX_VALUE;
		fin: for(long i = left; i < right; i++) {
			for(long j = i + 1; j <= right; j++) {
				if(i * j % 2019 < min) {
					min = i * j % 2019;
				}
				if(j % 2019 == 0 || i % 2019 == 0) {
					min = 0;
					break fin;
				}
			}
		}

		System.out.println(min);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		// input
		long left = scan.nextLong();
		long right = scan.nextLong();

		// check
		long min = Long.MAX_VALUE;
		fin: for(long i = left; i < right; i++) {
			for(long j = i + 1; j <= right; j++) {
				if(i * j % 2019 < min) {
					min = i * j % 2019;
				}
				if(j % 2019 == 0 || i % 2019 == 0) {
					min = 0;
					break fin;
				}
			}
		}

		System.out.println(min);
	} main {
		Scanner scan = new Scanner(System.in);

		// input
		long left = scan.nextLong();
		long right = scan.nextLong();

		// check
		long min = Long.MAX_VALUE;
		fin: for(long i = left; i < right; i++) {
			for(long j = i + 1; j <= right; j++) {
				if(i * j % 2019 < min) {
					min = i * j % 2019;
				}
				if(j % 2019 == 0 || i % 2019 == 0) {
					min = 0;
					break fin;
				}
			}
		}

		System.out.println(min);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long left = scan.nextLong(); left scan.nextLong() scan.nextLong scan long right = scan.nextLong(); right scan.nextLong() scan.nextLong scan long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE 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 scan = new Scanner(System.in);

		// input
		long left = scan.nextLong();
		long right = scan.nextLong();

		// check
		long min = Long.MAX_VALUE;
		fin: for(long i = left; i < right; i++) {
			for(long j = i + 1; j <= right; j++) {
				if(i * j % 2019 < min) {
					min = i * j % 2019;
				}
				if(j % 2019 == 0 || i % 2019 == 0) {
					min = 0;
					break fin;
				}
			}
		}

		System.out.println(min);
	}
} public class Main {


	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		// input
		long left = scan.nextLong();
		long right = scan.nextLong();

		// check
		long min = Long.MAX_VALUE;
		fin: for(long i = left; i < right; i++) {
			for(long j = i + 1; j <= right; j++) {
				if(i * j % 2019 < min) {
					min = i * j % 2019;
				}
				if(j % 2019 == 0 || i % 2019 == 0) {
					min = 0;
					break fin;
				}
			}
		}

		System.out.println(min);
	}
} Main
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		// input
		long left = scan.nextLong();
		long right = scan.nextLong();

		// check
		long min = Long.MAX_VALUE;
		fin: for(long i = left; i < right; i++) {
			for(long j = i + 1; j <= right; j++) {
				if(i * j % 2019 < min) {
					min = i * j % 2019;
				}
				if(j % 2019 == 0 || i % 2019 == 0) {
					min = 0;
					break fin;
				}
			}
		}

		System.out.println(min);
	}
}

