l,r = gets.split.map(&:to_i)
m=2019

lm = l % m
rm = r % m
cnt=m
if rm<lm
  puts 0
  exit 0
end

for i in lm..rm-1
  for j in i+1..rm
    cnt = [cnt,(i*j) % m].min
  end
end
cnt = 0 if lm==rm
puts cnt
