import java.util.*;
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 > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	}

} import java.util.*; util.* 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 > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		if(R-L > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		if(R-L > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	} 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 > 673) {
			System.out.println(0);
			return;
		} R-L > 673 R-L R L 673 {
			System.out.println(0);
			return;
		} System.out.println(0) System.out.println System.out System System.out 0 return; L %= 2019 L 2019 R %= 2019 R 2019 if(L >= R)
			R += 2019; L >= R L R R += 2019 R 2019 int ans = 2018; ans 2018 for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019); int i = L; int i = L; i L i < R i R i++ i++ i for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019); for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019); int j = i+1; int j = i+1; j i+1 i 1 j <= R j R j++ j++ j ans = Math.min(ans, i * j % 2019); 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 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 sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		if(R-L > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	}

} 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 > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	}

} Main
import java.util.*;
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 > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	}

}
