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();
		sc.close();
		long anser = 0;
		long min = 2 * (long) Math.pow(10, 9);
		//大きすぎる値は制約を越えるので０を出す
		if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		}
	}
} 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();
		sc.close();
		long anser = 0;
		long min = 2 * (long) Math.pow(10, 9);
		//大きすぎる値は制約を越えるので０を出す
		if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		}
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long anser = 0;
		long min = 2 * (long) Math.pow(10, 9);
		//大きすぎる値は制約を越えるので０を出す
		if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		}
	} main {

		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long anser = 0;
		long min = 2 * (long) Math.pow(10, 9);
		//大きすぎる値は制約を越えるので０を出す
		if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		}
	} 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 sc.close() sc.close sc long anser = 0; anser 0 long min = 2 * (long) Math.pow(10, 9); min 2 * (long) Math.pow(10, 9) 2 (long) Math.pow(10, 9) Math.pow Math 10 9 if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		} R-L>=2018 R-L R L 2018 System.out.println(0) System.out.println System.out System System.out 0 {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		} for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			} long i = L ; long i = L ; i L i<=R i R i++ i++ i {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			} {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			} for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				} long j = i+1; long j = i+1; j i+1 i 1 j <= R j R j++ j++ j {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				} {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				} anser = (i*j)%2019 anser (i*j)%2019 (i*j) i j 2019 min = Math.min(anser, min) min Math.min(anser, min) Math.min Math anser min 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 sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long anser = 0;
		long min = 2 * (long) Math.pow(10, 9);
		//大きすぎる値は制約を越えるので０を出す
		if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		long anser = 0;
		long min = 2 * (long) Math.pow(10, 9);
		//大きすぎる値は制約を越えるので０を出す
		if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		}
	}
} 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();
		sc.close();
		long anser = 0;
		long min = 2 * (long) Math.pow(10, 9);
		//大きすぎる値は制約を越えるので０を出す
		if(R-L>=2018) System.out.println(0);
		else {
			for(long i = L ; i<=R;i++) {
				for(long j = i+1; j <= R; j++) {
					anser = (i*j)%2019;
					min = Math.min(anser, min);
				}
			}
		System.out.println(min);
		}
	}
}