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

min = 9999999
min_2 = 9999999

for i in l..r
  mod = i % 2019

  if mod == 0
    puts 0
    exit
  end

  if min > mod
    min_2 = min
    min = mod
  elsif min_2 >mod
    min_2 = mod
  end
end

puts min * min_2