import 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;
		
		if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		}
		
		for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}
		
		System.out.println(min);
		scan.close();
	}

} import java.util.*; util.* java 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;
		
		if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		}
		
		for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}
		
		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;
		
		if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		}
		
		for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}
		
		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;
		
		if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		}
		
		for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}
		
		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 if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		} Math.abs(L - R) >= 2019 Math.abs(L - R) Math.abs Math L - R L R 2019 {
			System.out.println(0);
			scan.close();
			return;
		} System.out.println(0) System.out.println System.out System System.out 0 scan.close() scan.close scan return; for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		} long i = L; long i = L; i L i < R i R i++ i++ i {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		} {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		} for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			} {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			} if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				} min > (i * j) % 2019 min (i * j) % 2019 (i * j) i j 2019 {
					min = (i * j) % 2019;
				} min = (i * j) % 2019 min (i * j) % 2019 (i * j) i j 2019 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;
		
		if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		}
		
		for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}
		
		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;
		
		if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		}
		
		for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}
		
		System.out.println(min);
		scan.close();
	}

} Main
import 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;
		
		if(Math.abs(L - R) >= 2019) {
			System.out.println(0);
			scan.close();
			return;
		}
		
		for(long i = L; i < R; i++) {
			for(long j = i + 1; j <= R; j++) {
				if(min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}
		
		System.out.println(min);
		scan.close();
	}

}