#include<bits/stdc++.h>
using namespace std;
#define           ll              long long int
int main()
{
    ll L,R,v=3000;

    cin>>L>>R;
    ll p = min((L+10),R);
    for(ll i=L; i<=p; i++)
    {
        ll q = min((i+10),R);
        for(ll j=i+1; j<= q ; j++)
        {
            ll s=(i*j)%2019;
            v=min(s,v);
        }
    }
    cout<<v;
}
