#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 4e2 + 10;
const ll mod = 1e9 + 7;


int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//  freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);

  int l, r; cin >> l >> r;

  if (r - l + 1 >= 2019) cout << 0;
  else {
    ll ans = 2019;

    for (ll i = l; i <= r; ++i)
      for (ll j = i + 1; j <= r; ++j)
        ans = min(ans, (i * j) % 2019);

    cout << ans;
  }

  return 0;
}


#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b;
    cin >> a >> b;

    cout << max(a + b, max(a - b, a * b)) << '\n';

    return 0;
}