import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l=sc.nextLong(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			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(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			System.out.println(min);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l=sc.nextLong(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			System.out.println(min);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		long l=sc.nextLong(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			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 r=sc.nextLong() r sc.nextLong() sc.nextLong sc min=Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			System.out.println(min);
		} l==0 || r-l>=2018 l==0 l 0 r-l>=2018 r-l r l 2018 {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			System.out.println(min);
		} for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			} long i=l; long i=l; i l i<r i r i++ i++ i {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			} {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			} if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				} i%2019==0 i%2019 i 2019 0 {
					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 for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				} long j=l+1; long j=l+1; j l+1 l 1 j<=r j r j++ j++ j {
					min=Math.min(min, (i*j)%2019);
				} {
					min=Math.min(min, (i*j)%2019);
				} min=Math.min(min, (i*j)%2019) min Math.min(min, (i*j)%2019) Math.min Math 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 sc = new Scanner(System.in);
		long l=sc.nextLong(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			System.out.println(min);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l=sc.nextLong(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			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(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			System.out.println(min);
		}
	}
}

