#include <bits/stdc++.h>

using namespace std;

int main(){
	long long L, R;
	scanf("%lld%lld", &L, &R);
	
	int ans = 2019;
	for(long long i = L; i <= min(R, L+2024); i ++){
		for(long long j = i+1; j <= min(R, i+2024); j ++){
			ans = min(i*j%2019, (long long)ans);
		}
	}
	printf("%d", ans);
}
