import java.util.Scanner;

public class Main {

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

		if(r - l >= 2019) {
			System.out.println(0);
			return;
		}

		l = l % 2019;
		r = r % 2019;

		int tes = 2 * 1000000000;

		if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		}

		long min = 2019;

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

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		}

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

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

		if(r - l >= 2019) {
			System.out.println(0);
			return;
		}

		l = l % 2019;
		r = r % 2019;

		int tes = 2 * 1000000000;

		if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		}

		long min = 2019;

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

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		}

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

		if(r - l >= 2019) {
			System.out.println(0);
			return;
		}

		l = l % 2019;
		r = r % 2019;

		int tes = 2 * 1000000000;

		if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		}

		long min = 2019;

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

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		}

		System.out.println(min);
	} main {
		Scanner in = new Scanner(System.in);
		long l = in.nextInt();
		long r = in.nextInt();

		if(r - l >= 2019) {
			System.out.println(0);
			return;
		}

		l = l % 2019;
		r = r % 2019;

		int tes = 2 * 1000000000;

		if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		}

		long min = 2019;

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

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		}

		System.out.println(min);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) long l = in.nextInt(); l in.nextInt() in.nextInt in long r = in.nextInt(); r in.nextInt() in.nextInt in if(r - l >= 2019) {
			System.out.println(0);
			return;
		} r - l >= 2019 r - l r l 2019 {
			System.out.println(0);
			return;
		} System.out.println(0) System.out.println System.out System System.out 0 return; l = l % 2019 l l % 2019 l 2019 r = r % 2019 r r % 2019 r 2019 int tes = 2 * 1000000000; tes 2 * 1000000000 2 1000000000 if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		} (l * r) % 2019 == 0 (l * r) % 2019 (l * r) l r 2019 0 {
			System.out.println(0);
			return;
		} System.out.println(0) System.out.println System.out System System.out 0 return; long min = 2019; min 2019 for(long i = l; i <= r-1; i++) {
			for(long j = i + 1; j <= r; j++) {

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		} long i = l; long i = l; i l i <= r-1 i r-1 r 1 i++ i++ i {
			for(long j = i + 1; j <= r; j++) {

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		} {
			for(long j = i + 1; j <= r; j++) {

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		} for(long j = i + 1; j <= r; j++) {

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : 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;
				min = (min <= tmp) ? min : tmp;

			} {

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			} long tmp = (i * j) % 2019; tmp (i * j) % 2019 (i * j) i j 2019 min = (min <= tmp) ? min : tmp min (min <= tmp) ? min : tmp (min <= tmp) min tmp min tmp 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 in = new Scanner(System.in);
		long l = in.nextInt();
		long r = in.nextInt();

		if(r - l >= 2019) {
			System.out.println(0);
			return;
		}

		l = l % 2019;
		r = r % 2019;

		int tes = 2 * 1000000000;

		if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		}

		long min = 2019;

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

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		}

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

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

		if(r - l >= 2019) {
			System.out.println(0);
			return;
		}

		l = l % 2019;
		r = r % 2019;

		int tes = 2 * 1000000000;

		if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		}

		long min = 2019;

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

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		}

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

public class Main {

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

		if(r - l >= 2019) {
			System.out.println(0);
			return;
		}

		l = l % 2019;
		r = r % 2019;

		int tes = 2 * 1000000000;

		if((l * r) % 2019 == 0) {
			System.out.println(0);
			return;
		}

		long min = 2019;

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

				long tmp = (i * j) % 2019;
				min = (min <= tmp) ? min : tmp;

			}
		}

		System.out.println(min);
	}
}
