import           Data.List
import           Data.List.Split
import           Data.Time.Clock.POSIX (getPOSIXTime)
import           Debug.Trace

calcNoCancelLength :: [Int] -> Int
calcNoCancelLength pointList =
    if null b then
        0
    else
        abs((head pointList) - head b) + calcNoCancelLength b
    where
        b = tail pointList

getResult :: Int -> [Int] -> String
getResult noCancelLength list
    | (null (tail list)) || (null (tail (tail list))) =
        []
    | otherwise =
        '\n' : (show (noCancelLength - abs(a - b) - abs(b - c) + abs(a - c))) ++
        (getResult noCancelLength tail1)
        where
            a = head list
            b = head tail1
            c = head tail2
            tail1 = tail list
            tail2 = tail tail1

main = do
    _ <- readLn :: IO Int
    line2 <- getLine
    -- rawPointList = [A1, A2, ..., AN]
    rawPointList <- return $ map (\el -> read el :: Int) (splitOn " " line2)
    pointList <- return (0 : rawPointList ++ [0])
    putStrLn $ tail $ getResult (calcNoCancelLength pointList) pointList
