import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
long l, r;
		l = s.nextInt();
		r = s.nextInt();
		long ans = 2019;
		for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
long l, r;
		l = s.nextInt();
		r = s.nextInt();
		long ans = 2019;
		for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
long l, r;
		l = s.nextInt();
		r = s.nextInt();
		long ans = 2019;
		for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		}
		System.out.println(ans);
	} main {
		Scanner s = new Scanner(System.in);
long l, r;
		l = s.nextInt();
		r = s.nextInt();
		long ans = 2019;
		for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		}
		System.out.println(ans);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) long l l r; r l = s.nextInt() l s.nextInt() s.nextInt s r = s.nextInt() r s.nextInt() s.nextInt s long ans = 2019; ans 2019 for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		} long i = l; long i = l; i l i <= r i r i++ i++ i {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		} {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		} for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			} long j = i+1; long j = i+1; j i+1 i 1 j <= r j r j++ j++ j {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			} {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			} ans = Math.min(ans, (i * j) % 2019) ans Math.min(ans, (i * j) % 2019) Math.min Math ans (i * j) % 2019 (i * j) i j 2019 if(ans==0)break; ans==0 ans 0 break; if(ans==0)break; ans==0 ans 0 break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
long l, r;
		l = s.nextInt();
		r = s.nextInt();
		long ans = 2019;
		for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
long l, r;
		l = s.nextInt();
		r = s.nextInt();
		long ans = 2019;
		for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
long l, r;
		l = s.nextInt();
		r = s.nextInt();
		long ans = 2019;
		for (long i = l; i <= r; i++) {
			for (long j = i+1; j <= r; j++) {
				ans = Math.min(ans, (i * j) % 2019);
                if(ans==0)break;
			}
          if(ans==0)break;
		}
		System.out.println(ans);
	}
}