MOD = 2019
def solve(l, r)
    return 0 if r - l >= MOD
    results = Array.new()
    l.upto r do |i|
        (i+1).upto r do |j|
            results << (i*j) % MOD
        end
    end
    results.min
end

def main()
    l, r = gets.split.map(&:to_i)
    p solve(l, r)
end

main()
