#include<iostream>
using namespace std;
int main(){
	long long l,r;
	cin>>l>>r;
	if((l-1)/2019!=r/2019)
	{
		cout<<0;
		return 0;
	}
	int ans=2018*2018;
	for(long long i=l;i<r;i++)
	{
		for(long long k=i+1;k<=r;k++)
		{
			if((k*i)%2019<ans && k!=i)
				ans=(k*i)%2019;
		}
	}
	cout<<ans;
}