

foo :: Int -> [Int] -> [Int]
foo x []     = []
foo x (n:ns) = x:foo next ns
  where next = 2 * n - x

bar :: [Int] -> Int
bar [] = 0
bar [x] = x
bar (x:y:ys) = x - y + bar ys

printList :: [Int] -> IO ()
printList ints = putStrLn $ unwords $ map show ints

main = do
  _ <- getLine
  nums <- map read . words <$> getLine :: IO [Int]
  printList $ foo (bar nums) nums
