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

int main(){
    
    int l,r;
    cin >> l >> r;
    const int num = 2019;
    int comp = INT_MAX;
    long long ans = 0;
    for(long long i=l; i<=r; i++){
        for(long long j=l; j<i; j++){
            ans = ((i%num) * (j%num))%num;
            if(ans < comp){
                comp = ans;
            }
            else if(ans == 0){
                cout << ans << endl;
                return 0;
            }
        }
    }
    cout << comp << endl;
}
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

#define MOD 2019

int main(){
  long long int L = 0,R = 0;
  cin >> L >> R;
  if(L + MOD <= R){
    cout << 0 << endl;
  }else{
  L = L % MOD;
  R = R % MOD;
  int answer = 100000000;
  for(int i = L;i < R;i++){
    for(int j = i + 1;j <= R;j++){
      answer = min(answer,((i*j)%2019));
    }
  }
  cout << answer << endl;
}
}
