l, r = gets.split.map(&:to_i)
i_list = Array.new
z_list = Array.new

#print(i_list, "\n")
res = 2019
for i in l..r-1
  for j in l+1..r
    z = (i*j)%2019
    if z < res
      res = z
    end
    if res == 0
      puts z
      exit
    end
  end
end

p res
