#import <Foundation/Foundation.h>
typedef long long INT;
#define M 2019
int main(){
    INT L,R;
    scanf("%lld %lld",&L,&R);
    INT ans = M;
    for(INT i=L;i<=MIN(L+M,R-1);i++){
        for(INT j=i+1;j<=MIN(i+M,R);j++) {
            ans = MIN((i%M)*(j%M)%M,ans);
        }
    }
    printf("%lld",ans);
}
