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

int main(){
    ll n,m;
    cin>>n>>m;
    ll ans=2019;
    for (ll i = n; i < min(m,n+2020); ++i) {
        for (ll j = i+1; j <=min(m,i+2020) ; ++j) {
            ans=min(ans,i*j%2019);
        }
    }
    cout<<ans;
    return 0;
}