#include <iostream>
using namespace std;

int main()
{
  long long L, R;
  cin >> L >> R;
  R = min(R, L + 2019);
    
  long long a = 2018;
  for (auto i = L; i <= R; i++) {
    for (auto j = i + 1; j <= R; j++) {
      long long x = i * j % 2019;
      a = min(a, x);
    }
  }
  cout << a;
}