#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M (2019)
ll l,r,ans=1e9;

int main(){
	scanf("%lld%lld",&l,&r);
	if (r-l>=2019){
		printf("0"); return 0;
	}
	for (int i=l;i<r;i++)
		for (int j=i+1;j<=r;j++)
			ans=min(ans,1ll*i%M*j%M);
	printf("%lld",ans);
}
