#include<bits/stdc++.h>
using namespace std;
int l,r,ans=1e9;
int main()
{
	cin>>l>>r;
	if(r-l>=2019)cout<<0;
	else
	{
		l%=2019,r%=2019;
		if(r<l)r+=2019;
		for(int i=l;i<=r;i++)
			for(int j=i+1;j<=r;j++)
				ans=min(ans,(i*j)%2019);
		cout<<ans;
	}
}