#include<iostream>
using namespace std;
int main(){
	unsigned long long l,r;
	cin>>l>>r;
	if(r-l>=2018){
		cout<<0;
		return 0;
	}
	unsigned long long minv=-1;
	for(unsigned long long i=l;i<r;++i)
		for(unsigned long long j=i+1;j<=r;++j)
			minv=min(minv,i*j%2019);
	cout<<minv;
	return 0;
}