solve :: [Int] -> [Int]
solve (n:as) = 
    take n $ zipWith (+) res1 res2
    where 
        func1 s a = (-1) * s + a    
        res1 = scanl func1 0 as
        func2 a s = (-1) * s + a    
        res2 = scanr func2 0 as

main = interact $ unwords.map show.solve.map read.words


