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 sqrt.times do |j| b = j * j if a + b < 10_000_000 ans[a + b] += 1 end end end puts ans[x..y].max * 4