//JSD
#include<iostream>
#define ll long long 
using namespace std;
int main(){
	ll l,r;
	cin>>l>>r;
	if(r-l+1>=2019){
		cout<<"0";
	}
	else{
		ll ans=2020;
		for(ll i=l;i<r;i++){
			for(ll j=i+1;j<=r;j++){
				ll p=(i*j)%2019;
				ans=min(ans,p);
			}
		}
		cout<<ans;
	}
	cout<<"\n";
	return 0;
}