import java.util.*;
import java.lang.*;

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

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			int min = 2019;
			for (int i = l % 2019; i <= l % 2019 + (r - l); i++) {
				for (int j = i + 1; j <= l % 2019 + (r - l); j++) {
					min = Math.min(min, i * j % 2019);
				}
			}
			System.out.println(min);
		}
	}
}