import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInteger' = fst.fromJust.C.readInteger
readLnInteger = map readInteger'.C.words<$>C.getLine
readCsInteger n = concat<$>replicateM n readLnInteger

x ? (a,b) = if x then a else b
half = flip div 2
aliq = ((0==).).mod

-- さんすうができなくてつらい

main = do
 [n] <- readLnInteger
 inputs <- readLnInteger
 putStr.unwords.map show $ solve n inputs

solve 0 s = []
solve n s@(a:xs) = [calc s] ++ solve (n-1) (s++[a])

calc [a] = a
calc (a:b:x) = a - b + (null x)?(0,calc x)
