import Data.List

main = interact $ unlines . map (show . surface_area_of_QP) . init . groupAt 2 . map read . lines

surface_area_of_QP [x,h] = x^2 + 4 * (x/2) * sqrt ((x/2)^2 + h^2)

groupAt n [] = []
groupAt n xs = take n xs : groupAt n (drop n xs)