import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		}
		
		in.close();

	}

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

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		}
		
		in.close();

	}

} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		}
		
		in.close();

	} main {
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		}
		
		in.close();

	} Scanner in = new Scanner(System.in); in new Scanner(System.in) long l = in.nextLong(); l in.nextLong() in.nextLong in long r = in.nextLong(); r in.nextLong() in.nextLong in if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		} r-l+1>=2019 r-l+1 r-l r l 1 2019 System.out.println(0) System.out.println System.out System System.out 0 {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		} long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			} long i=l; long i=l; i l i<=r i r i++ i++ i {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			} {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			} for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				} long j=i+1; long j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				} {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				} long tmp = ((i%2019)*(j%2019))%2019; tmp ((i%2019)*(j%2019))%2019 ((i%2019)*(j%2019)) (i%2019) i 2019 (j%2019) j 2019 2019 if(tmp<min) min = tmp; tmp<min tmp min min = tmp min tmp System.out.println(min) System.out.println System.out System System.out min in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		}
		
		in.close();

	}

} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		}
		
		in.close();

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		if(r-l+1>=2019) System.out.println(0);
		else {
			long min = Long.MAX_VALUE;
			for(long i=l;i<=r;i++) {
				for(long j=i+1;j<=r;j++) {
					long tmp = ((i%2019)*(j%2019))%2019;
					if(tmp<min) min = tmp;
				}
			}
			System.out.println(min);
		}
		
		in.close();

	}

}
