#include<iostream>
using namespace std;
int ans=0x3f3f3f3f;
int main(){
	int l,r;
	cin>>l>>r;
	if(r-l+1>2019){
		cout<<0<<endl;
	}
	else{
		l%=2019,r%=2019;
		for(int i=l;i<=r-1;i++){
			for(int j=i+1;j<=r;j++){
				int k=(i*j)%2019;
				ans=min(ans,k);
				
			}
		}
		cout<<ans<<endl;
	}
}