import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long L = stdIn.nextInt();
		long R = stdIn.nextInt();
		for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		}
		
		long min = 2018;
		for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		}
		
		System.out.println(min);

	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long L = stdIn.nextInt();
		long R = stdIn.nextInt();
		for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		}
		
		long min = 2018;
		for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		}
		
		System.out.println(min);

	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long L = stdIn.nextInt();
		long R = stdIn.nextInt();
		for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		}
		
		long min = 2018;
		for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		}
		
		System.out.println(min);

	} main {
		Scanner stdIn = new Scanner(System.in);
		long L = stdIn.nextInt();
		long R = stdIn.nextInt();
		for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		}
		
		long min = 2018;
		for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		}
		
		System.out.println(min);

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) long L = stdIn.nextInt(); L stdIn.nextInt() stdIn.nextInt stdIn long R = stdIn.nextInt(); R stdIn.nextInt() stdIn.nextInt stdIn for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		} long i = L; long i = L; i L i <= R i R i++ i++ i {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		} {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		} if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			} i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L) i%673 == 0 i%673 i 673 0 ((R-L+1) >= 3 || i-1 >= L) (R-L+1) >= 3 (R-L+1) R-L R L 1 3 i-1 >= L i-1 i 1 L {
				System.out.println(0);
				System.exit(0);
			} System.out.println(0) System.out.println System.out System System.out 0 System.exit(0) System.exit System 0 long min = 2018; min 2018 for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					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((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		} {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		} for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					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((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			} {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			} if((i*j)%2019 < min) {
					min = (i*j)%2019;
				} (i*j)%2019 < min (i*j)%2019 (i*j) i j 2019 min {
					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 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long L = stdIn.nextInt();
		long R = stdIn.nextInt();
		for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		}
		
		long min = 2018;
		for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		}
		
		System.out.println(min);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long L = stdIn.nextInt();
		long R = stdIn.nextInt();
		for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		}
		
		long min = 2018;
		for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		}
		
		System.out.println(min);

	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long L = stdIn.nextInt();
		long R = stdIn.nextInt();
		for(long i = L; i <= R; i++) {
			if(i%673 == 0 && ((R-L+1) >= 3 || i-1 >= L)) {
				System.out.println(0);
				System.exit(0);
			}
		}
		
		long min = 2018;
		for(long i = L; i < R; i++) {
			for(long j = i+1; j <= R; j++) {
				if((i*j)%2019 < min) {
					min = (i*j)%2019;
				}
			}
		}
		
		System.out.println(min);

	}

}