import Data.List
import Data.List.Split

-- i <- [1..N]
-- pointList = [0, A1, ..., AN, 0]
calcPathLength :: [Int] -> Int -> Int -> Int
calcPathLength pointList n i_canceled =
    sum [abs ((pointList !! i_x) - (pointList !! if i_x + 1 == i_canceled then i_x + 2 else i_x + 1)) |
        i_x <- [0..n], i_x /= i_canceled]

printResult :: [Int] -> Int -> Int -> IO ()
printResult pointList n iter
    | iter == n = do
        print $ calcPathLength pointList n iter
    | iter < n = do
        print $ calcPathLength pointList n iter
        printResult pointList n (iter + 1)

main = do
    n <- readLn :: IO Int
    line2 <- getLine
    -- rawPointList = [A1, A2, ..., AN]
    rawPointList <- return $ map (\el -> read el :: Int) (splitOn " " line2)
    printResult (0 : rawPointList ++ [0]) n 1
