X, Y = gets.split.map &:to_i h = Hash.new(0) ans = 0 for y in 0..Math.sqrt(Y) do for x in 0..(Math.sqrt(Y) - 1) do rr = y**2 + x**2 if X <= rr && rr <= Y then h[rr] += 1 ans = [ans, h[rr]].max end end end puts ans*4