#include <bits/stdc++.h>
#define ll long long 
using namespace std;

int main() 
{
	ll l , r;
	cin >> l >> r;
	if(r-l>2019)
		cout << 0;
	else
	{
		ll ans = 2019*2019 ;
		for(ll i = l ; i <= r ; i++)
			for(ll j = i+1 ; j <= r ; j++)
				ans = min(ans,((i%2019)*(j%2019))%2019);
		cout << ans;
	}
}