#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  if (r - l + 1 >= 2019)
    cout << 0 << endl;
  else {
    long long ans = 2020 * 2020;
    for (long long i = l; i <= r; i++) {
      for (long long j = l + 1; j <= r; j++) {
        if (ans > (i * j) % 2019) ans = (i * j) % 2019;
      }
    }
    cout << ans << endl;
  }
}
