X, Y = gets.split.map(&:to_i) R = Math.sqrt(Y).ceil C = Hash.new(0) (1 .. R).each do |x| (0 .. R).each do |y| r2 = x ** 2 + y ** 2 C[r2] += 1 unless r2 < X || r2 > Y end end puts (C.values.max || 0) * 4