#include<iostream>
using namespace std;
int ans=2019;
long L,R;
int main()
{
	cin>>L>>R;
	for(int i=L;i<=R&&i<=L+2019;i++)
	{
		for(int j=i+1;j<=R&&j<=i+2019;j++)
		{
			long I=i,J=j;
			if(I*J%2019<ans)ans=I*J%2019;
		}
	}
	cout<<ans<<endl;
}
