import Control.Monad

main = do
  n <- getLine
  a <- map read . words <$> getLine
  forM_ (solve a) $ \t -> 
    putStrLn . show $ t

solve :: [Int] -> [Int]
solve xs =
  let wp = wholePath xs
  in inSolve 0 wp (xs ++ [0])

inSolve prev ttl [] = []
inSolve prev ttl (x:[]) = []
inSolve prev ttl (x:y:xs) = 
  if prev <= x && x <= y || prev >= x && x >= y then
    ttl:(inSolve x ttl (y:xs))
  else
    (ttl + (abs (prev - y)) - (abs (x - y)) - (abs (prev - x))):(inSolve x ttl (y:xs))

wholePath xs = (abs (head xs)) + difsum xs 

difsum :: [Int] -> Int
difsum [] = 0
difsum (x:[]) = abs x
difsum (x:y:xs) = (abs (x-y)) + (difsum (y:xs))