#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long long l, r;
	cin >> l >> r;
	long long res = 1e10;
	for (long long i = l; i <= min(2019 + l, r); i++) {
		for (long long j = i + 1; j <= min(2019 + l, r); j++) {
			res = min(res, i * j % 2019);
		}
	}
	cout << res << endl;
}