import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto lr = readln.split.to!(long[]);
    auto L = lr[0];
    auto R = lr[1]+1;

    long x = long.max;
    foreach (l; L..min(L+2020, R)) {
        foreach (r; l+1..min(L+2020,R)) {
            x = min(x, (l*r)%2019L);
        }
    }
    writeln(x);
}