import java.util.Scanner;

public class Main {

	private static final int k = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
      	int R = sc.nextInt();
      	
      	if (L == 0) {
      		System.out.println(0);
      		return ;
      	}
      	
      	if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	}
      	
      	int res = Integer.MAX_VALUE;
      	L = L % k;
      	R = R % k;
      	
      	if (L > R) {
      		System.out.println(0);
      		return;
      	}
      	
        for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        }
      	
      	
      	System.out.println(res);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	private static final int k = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
      	int R = sc.nextInt();
      	
      	if (L == 0) {
      		System.out.println(0);
      		return ;
      	}
      	
      	if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	}
      	
      	int res = Integer.MAX_VALUE;
      	L = L % k;
      	R = R % k;
      	
      	if (L > R) {
      		System.out.println(0);
      		return;
      	}
      	
        for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        }
      	
      	
      	System.out.println(res);
		sc.close();
	}
} Main private static final int k = 2019; k 2019 public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
      	int R = sc.nextInt();
      	
      	if (L == 0) {
      		System.out.println(0);
      		return ;
      	}
      	
      	if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	}
      	
      	int res = Integer.MAX_VALUE;
      	L = L % k;
      	R = R % k;
      	
      	if (L > R) {
      		System.out.println(0);
      		return;
      	}
      	
        for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        }
      	
      	
      	System.out.println(res);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
      	int R = sc.nextInt();
      	
      	if (L == 0) {
      		System.out.println(0);
      		return ;
      	}
      	
      	if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	}
      	
      	int res = Integer.MAX_VALUE;
      	L = L % k;
      	R = R % k;
      	
      	if (L > R) {
      		System.out.println(0);
      		return;
      	}
      	
        for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        }
      	
      	
      	System.out.println(res);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc if (L == 0) {
      		System.out.println(0);
      		return ;
      	} L == 0 L 0 {
      		System.out.println(0);
      		return ;
      	} System.out.println(0) System.out.println System.out System System.out 0 return ; if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	} R - L > 2018 R - L R L 2018 {
      		System.out.println(0);
      		return;
      	} System.out.println(0) System.out.println System.out System System.out 0 return; int res = Integer.MAX_VALUE; res Integer.MAX_VALUE Integer Integer.MAX_VALUE L = L % k L L % k L k R = R % k R R % k R k if (L > R) {
      		System.out.println(0);
      		return;
      	} L > R L R {
      		System.out.println(0);
      		return;
      	} System.out.println(0) System.out.println System.out System System.out 0 return; for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        } int i = L; int i = L; i L i <= (R-1) i (R-1) R 1 i++ i++ i {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        } {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        } for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		} int j = i+1; int j = i+1; j i+1 i 1 j <= R j R j++ j++ j {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		} {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		} int candidate = (i%k)*(j%k)%k; candidate (i%k)*(j%k)%k (i%k)*(j%k) (i%k) i k (j%k) j k k res = Math.min(res, candidate) res Math.min(res, candidate) Math.min Math res candidate System.out.println(res) System.out.println System.out System System.out res sc.close() sc.close sc String[] args args public class Main {

	private static final int k = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
      	int R = sc.nextInt();
      	
      	if (L == 0) {
      		System.out.println(0);
      		return ;
      	}
      	
      	if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	}
      	
      	int res = Integer.MAX_VALUE;
      	L = L % k;
      	R = R % k;
      	
      	if (L > R) {
      		System.out.println(0);
      		return;
      	}
      	
        for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        }
      	
      	
      	System.out.println(res);
		sc.close();
	}
} public class Main {

	private static final int k = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
      	int R = sc.nextInt();
      	
      	if (L == 0) {
      		System.out.println(0);
      		return ;
      	}
      	
      	if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	}
      	
      	int res = Integer.MAX_VALUE;
      	L = L % k;
      	R = R % k;
      	
      	if (L > R) {
      		System.out.println(0);
      		return;
      	}
      	
        for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        }
      	
      	
      	System.out.println(res);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	private static final int k = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
      	int R = sc.nextInt();
      	
      	if (L == 0) {
      		System.out.println(0);
      		return ;
      	}
      	
      	if (R - L > 2018) {
      		System.out.println(0);
      		return;
      	}
      	
      	int res = Integer.MAX_VALUE;
      	L = L % k;
      	R = R % k;
      	
      	if (L > R) {
      		System.out.println(0);
      		return;
      	}
      	
        for (int i = L; i <= (R-1); i++) {
      		for (int j = i+1; j <= R; j++) {
      			int candidate = (i%k)*(j%k)%k;
      			res = Math.min(res, candidate);
      		}
        }
      	
      	
      	System.out.println(res);
		sc.close();
	}
}