#include<bits/stdc++.h>
using ll=long long;
#define rep(i,j,n) for(ll i=(j);i<(n);i++)
#define per(i,n,j) for(ll i=(n);i>=(j);i--)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

ll l,r;

int main(){
    cin>>l>>r;
    ll ans=INF;
    rep(i,l,min(l+2019,r)){
        rep(j,l+1,min(l+2020,r+1)){
            ll num=(i*j)%2019;
            chmin(ans,num);
        }
    }
    /*if(l%2019==0 ||l%2019>=r%2019 || r-l>=2019) ans=0;
    else{
        ll num;
        num=l%2019*(l+1)%2019;
        if(num<2019) ans=num;
        else ans=num%2019;
    }*/
    cout<<ans<<"\n";
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int l, r;
    cin >> l >> r;

    if (r - l + 1 >= 2019) {
        cout << 0 << endl;
        return 0;
    }
    ll res = INF;
    for (ll i = l; i < r; ++i) {
        for (ll j = l+1; j <= r; ++j) {
            chmin(res, (i*j) % 2019);
        }
    }
    cout << res << endl;
}
