#include<iostream>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
if( (b-a) >= 4038)
cout<<'0';
else
{
int ans = 2018;
for(int i=a;i<=b;i++)
for(int j=i+1;j<=b;j++)
{
int now = ( (i%2019)*(j%2019) )%2019;
if( now < ans )
ans = now;
}
cout << ans ;
}
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsKICAgIGludCBhLGI7CiAgICBjaW4gPj4gYSA+PiBiOwogICAgaWYoIChiLWEpID49IDQwMzgpCiAgICAgICAgY291dDw8JzAnOwogICAgZWxzZQogICAgewogICAgICAgIGludCBhbnMgPSAyMDE4OwogICAgICAgIGZvcihpbnQgaT1hO2k8PWI7aSsrKQogICAgICAgICAgICBmb3IoaW50IGo9aSsxO2o8PWI7aisrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpbnQgbm93ID0gKCAoaSUyMDE5KSooaiUyMDE5KSApJTIwMTk7CiAgICAgICAgICAgICAgICBpZiggbm93IDwgYW5zICkKICAgICAgICAgICAgICAgICAgICBhbnMgPSBub3c7CiAgICAgICAgICAgIH0KICAgICAgICBjb3V0IDw8IGFucyA7CiAgICB9Cn0=