import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long a = sc.nextInt(); a sc.nextInt() sc.nextInt sc long b = sc.nextInt(); b sc.nextInt() sc.nextInt sc long min = a * (a + 1) % 2019; min a * (a + 1) % 2019 a * (a + 1) a (a + 1) a 1 2019 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	}

}
