#include<bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;
int main(){
    Int l,r;
    cin >> l >> r;
	Int ans = 1e9;
	if(l+2018 <= r){
		ans = 0;
	}else{
		for(Int i=l; i<r; ++i)
			for(Int j=i+1; j<=r; ++j)
				ans = min(ans, i*j%2019);
	}
	cout << ans << "\n";
  return 0;
}