L, R=gets.split.map(&:to_i)
ans = 10**9
l = L%2019
r = R%2019
if l > r
  l, r = r, l
end
(l..r).each do |i|
  (i..r).each do |j|
    next if i==j
    ans = i*j%2019 if ans > i*j%2019
  end
end
p ans
  
