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

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(long L, long R) {
    long ans = long.max;
    foreach (i; L..R+1) {
        foreach (j; i+1..R+1) {
            ans = min(ans, i * j % 2019);
            if (ans == 0) return ans;
        }
    }
    return ans;
}

void main() {
    int L, R; scan(L, R);
    writeln(calc(L, R));
}
