import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();
		int r = in.nextInt();
		
        int mod = 2019;
		// 2019の倍数が必ずある場合
		if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		}

		long min = Long.MAX_VALUE;
		long remain = 0;
		for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		}
		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);
		int l = in.nextInt();
		int r = in.nextInt();
		
        int mod = 2019;
		// 2019の倍数が必ずある場合
		if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		}

		long min = Long.MAX_VALUE;
		long remain = 0;
		for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		}
		System.out.println(min);
		in.close();
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();
		int r = in.nextInt();
		
        int mod = 2019;
		// 2019の倍数が必ずある場合
		if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		}

		long min = Long.MAX_VALUE;
		long remain = 0;
		for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		}
		System.out.println(min);
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();
		int r = in.nextInt();
		
        int mod = 2019;
		// 2019の倍数が必ずある場合
		if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		}

		long min = Long.MAX_VALUE;
		long remain = 0;
		for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		}
		System.out.println(min);
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int l = in.nextInt(); l in.nextInt() in.nextInt in int r = in.nextInt(); r in.nextInt() in.nextInt in int mod = 2019; mod 2019 if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		} r-l >= mod r-l r l mod {
			System.out.println(0);
			in.close();
			return;
		} System.out.println(0) System.out.println System.out System System.out 0 in.close() in.close in return; long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE long remain = 0; remain 0 for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		} long i = l; long i = l; i l i < r i r i++ i++ i {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		} {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		} for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			} long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			} {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			} remain = i * j % mod remain i * j % mod i * j i j mod min = remain < min ? remain : min min remain < min ? remain : min remain < min remain min remain min 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);
		int l = in.nextInt();
		int r = in.nextInt();
		
        int mod = 2019;
		// 2019の倍数が必ずある場合
		if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		}

		long min = Long.MAX_VALUE;
		long remain = 0;
		for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		}
		System.out.println(min);
		in.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();
		int r = in.nextInt();
		
        int mod = 2019;
		// 2019の倍数が必ずある場合
		if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		}

		long min = Long.MAX_VALUE;
		long remain = 0;
		for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		}
		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);
		int l = in.nextInt();
		int r = in.nextInt();
		
        int mod = 2019;
		// 2019の倍数が必ずある場合
		if(r-l >= mod) {
			System.out.println(0);
			in.close();
			return;
		}

		long min = Long.MAX_VALUE;
		long remain = 0;
		for ( long i = l; i < r; i++ ) {
			for ( long j = i + 1; j <= r; j++ ) {
				remain = i * j % mod;
				min = remain < min ? remain : min;
			}
		}
		System.out.println(min);
		in.close();
	}
}