import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	} main {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long L = scan.nextLong(); L scan.nextLong() scan.nextLong scan long R = scan.nextLong(); R scan.nextLong() scan.nextLong scan long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		} long i=L; long i=L; i L i<R i R i++ i++ i {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		} {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		} for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			} long j=L+1; long j=L+1; j L+1 L 1 j<=R j R j++ j++ j {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			} {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			} long re = (i*j)%2019; re (i*j)%2019 (i*j) i j 2019 if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			} re < min re min {
				min = re;
			} min = re min re if(re == 0) {
				System.out.println(0);
				return;
			} re == 0 re 0 {
				System.out.println(0);
				return;
			} System.out.println(0) System.out.println System.out System System.out 0 return; System.out.println(min) System.out.println System.out System System.out min scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	}

}
