#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int i,j,l,r,m=2019,c[2019]={0};
	cin>>l>>r;
	if(r-l<2018)for(i=l;i<=r;i++)c[i%2019]=1;
	else for(i=0;i<2019;i++)c[i]=1;
	for(i=0;i<2018;i++)for(j=i+1;j<2019;j++)if(c[i]&&c[j])m=min(m,i*j%2019);
	cout<<m<<endl;
	return 0;
}