n,m = gets.split.map(&:to_i)
num = Array.new(2019,0)
if m-n >= 2018
  puts 0
  exit
end
count = n % 2019
num[count] = 1
while count != m % 2019
  count += 1
  count %= 2019
  num[count] = 1
end
ans = 10**10
for i in 0..2018
  if num[i] == 1
    for j in 0..2018
      if num[j] == 1 && i != j
        if ans > (i*j)%2019
          ans = (i*j)%2019
        end
      end
    end
  end
end
puts ans
