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();
	    int min = Integer.MAX_VALUE;

	    for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,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();
	    int min = Integer.MAX_VALUE;

	    for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,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();
	    int min = Integer.MAX_VALUE;

	    for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	}
	    }
	    System.out.println(min);
	} main {
		Scanner sc = new Scanner(System.in);
	    long L =sc.nextLong();
	    long R = sc.nextLong();
	    int min = Integer.MAX_VALUE;

	    for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,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 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	}
	    } int i=0; int i=0; i 0 i<2018 i 2018 i++ i++ i {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	}
	    } {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	}
	    } long num1 = L+i; num1 L+i L i if(num1>R)break; num1>R num1 R break; for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	} int j=i+1; int j=i+1; j i+1 i 1 j<2019 j 2019 j++ j++ j {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	} {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	} long num2 = L+j; num2 L+j L j if(num2>R)break; num2>R num2 R break; int a = (int)(((num1%2019)*(num2%2019))%2019); a (int)(((num1%2019)*(num2%2019))%2019) ((num1%2019)*(num2%2019)) (num1%2019) num1 2019 (num2%2019) num2 2019 2019 min = Math.min(a,min) min Math.min(a,min) Math.min Math a 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();
	    int min = Integer.MAX_VALUE;

	    for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,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();
	    int min = Integer.MAX_VALUE;

	    for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,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();
	    int min = Integer.MAX_VALUE;

	    for(int i=0;i<2018;i++) {
	    	long num1 = L+i;
	    	if(num1>R)break;
	    	for(int j=i+1;j<2019;j++) {
		    	long num2 = L+j;
		    	if(num2>R)break;
		    	int a = (int)(((num1%2019)*(num2%2019))%2019);
		    	min = Math.min(a,min);
	    	}
	    }
	    System.out.println(min);
	}



}