#include <bits/stdc++.h>

#define MAXN 200001

#define MOD 2019

using namespace std;

int A, B, mid, out=INT_MAX;

int main(){

	cin>>A>>B;	for(int i=A;i<min(A+2019, B);i++)

		for(int j=A+1;j<=min(A+2019, B);j++)

			out=min(out, ((i%MOD)*(j%MOD))%MOD);

	cout<<out;

}