x, y = gets.strip.split.map(&:to_i) ans = Array.new(10_000_000, 0) sqrt = Integer.sqrt y 1.step(sqrt) do |i| a = i * i 0.step(sqrt) do |j| b = j * j if a + b < y ans[a + b] += 1 end end end puts ans[x..y].max * 4