import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int l = sc.nextInt();
		int r = sc.nextInt();

		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		}

		// 出力
		System.out.println(result);
	}
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.math.BigInteger; BigInteger java.math public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int l = sc.nextInt();
		int r = sc.nextInt();

		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		}

		// 出力
		System.out.println(result);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int l = sc.nextInt();
		int r = sc.nextInt();

		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		}

		// 出力
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int l = sc.nextInt();
		int r = sc.nextInt();

		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		}

		// 出力
		System.out.println(result);
	} 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 int result = Integer.MAX_VALUE; result Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		} int i = l; int i = l; i l i < min(l + 2019, r + 1) i min(l + 2019, r + 1) min l + 2019 l 2019 r + 1 r 1 i++ i++ i {
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		} {
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		} for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    } int j = i + 1; int j = i + 1; j i + 1 i 1 j < min(l + 2019, r + 1) j min(l + 2019, r + 1) min l + 2019 l 2019 r + 1 r 1 j++ j++ j {
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    } {
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    } result = min(result, ((i%2019)*(j%2019))%2019) result min(result, ((i%2019)*(j%2019))%2019) min result ((i%2019)*(j%2019))%2019 ((i%2019)*(j%2019)) (i%2019) i 2019 (j%2019) j 2019 2019 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int l = sc.nextInt();
		int r = sc.nextInt();

		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		}

		// 出力
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int l = sc.nextInt();
		int r = sc.nextInt();

		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		}

		// 出力
		System.out.println(result);
	}
} Main
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int l = sc.nextInt();
		int r = sc.nextInt();

		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = l; i < min(l + 2019, r + 1); i++){
		    for(int j = i + 1; j < min(l + 2019, r + 1); j++){
		        result = min(result, ((i%2019)*(j%2019))%2019);
		    }
		}

		// 出力
		System.out.println(result);
	}
}
