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