import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args){
		
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
        int D = input.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
		System.out.println(remain);
	}
} import java.util.Scanner; Scanner java.util public class Main {
 
	public static void main(String[] args){
		
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
        int D = input.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
		System.out.println(remain);
	}
} Main public static void main(String[] args){
		
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
        int D = input.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
		System.out.println(remain);
	} main {
		
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
        int D = input.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
		System.out.println(remain);
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int N = input.nextInt(); N input.nextInt() input.nextInt input int D = input.nextInt(); D input.nextInt() input.nextInt input long remain = (long)(2 * Math.pow(10,9)) * 2; remain (long)(2 * Math.pow(10,9)) * 2 (long)(2 * Math.pow(10,9)) 2 Math.pow(10,9) Math.pow Math 10 9 2 for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        } long i = N; long i = N; i N i < D i D i++ i++ i {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        } {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        } for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= D j D j++ j++ j {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            } {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            } if((i*j)%2019 < remain)
                    remain = (i*j)%2019; (i*j)%2019 < remain (i*j)%2019 (i*j) i j 2019 remain remain = (i*j)%2019 remain (i*j)%2019 (i*j) i j 2019 if(remain == 0)
                    break; remain == 0 remain 0 break; if(remain == 0)
                break; remain == 0 remain 0 break; System.out.println(remain) System.out.println System.out System System.out remain String[] args args public class Main {
 
	public static void main(String[] args){
		
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
        int D = input.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
		System.out.println(remain);
	}
} public class Main {
 
	public static void main(String[] args){
		
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
        int D = input.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
		System.out.println(remain);
	}
} Main
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args){
		
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
        int D = input.nextInt();
        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = N; i < D; i++) {
            for (long j = i + 1; j <= D; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
		System.out.println(remain);
	}
}