import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		int minmod = 2020;
		loop: for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				minmod = (int) Math.min(minmod, (i % 2019) * (j % 2019) % 2019);
				if(minmod % 2019 == 0) {
					break loop;
				}
			}
		}
		System.out.println(minmod);
	}

} 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.nextLong();
		long R = sc.nextLong();
		int minmod = 2020;
		loop: for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				minmod = (int) Math.min(minmod, (i % 2019) * (j % 2019) % 2019);
				if(minmod % 2019 == 0) {
					break loop;
				}
			}
		}
		System.out.println(minmod);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		int minmod = 2020;
		loop: for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				minmod = (int) Math.min(minmod, (i % 2019) * (j % 2019) % 2019);
				if(minmod % 2019 == 0) {
					break loop;
				}
			}
		}
		System.out.println(minmod);
	} main {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		int minmod = 2020;
		loop: for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				minmod = (int) Math.min(minmod, (i % 2019) * (j % 2019) % 2019);
				if(minmod % 2019 == 0) {
					break loop;
				}
			}
		}
		System.out.println(minmod);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextLong(); L sc.nextLong() sc.nextLong sc long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc int minmod = 2020; minmod 2020 System.out.println(minmod) System.out.println System.out System System.out minmod String[] args args public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		int minmod = 2020;
		loop: for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				minmod = (int) Math.min(minmod, (i % 2019) * (j % 2019) % 2019);
				if(minmod % 2019 == 0) {
					break loop;
				}
			}
		}
		System.out.println(minmod);
	}

} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		int minmod = 2020;
		loop: for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				minmod = (int) Math.min(minmod, (i % 2019) * (j % 2019) % 2019);
				if(minmod % 2019 == 0) {
					break loop;
				}
			}
		}
		System.out.println(minmod);
	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		int minmod = 2020;
		loop: for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				minmod = (int) Math.min(minmod, (i % 2019) * (j % 2019) % 2019);
				if(minmod % 2019 == 0) {
					break loop;
				}
			}
		}
		System.out.println(minmod);
	}

}