{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           System.IO

readT :: Read a => T.Text -> a
readT = read . T.unpack

getLineSpc :: Read a => IO [a]
getLineSpc = do
  t <- T.getLine
  let xs = map readT $ T.split (== ' ') t
  return xs

main :: IO ()
main = travelingPlan

travelingPlan :: IO ()
travelingPlan = do
  n   :: Int   <- readLn
  as' :: [Int] <- getLineSpc
  let as    = 0 : as' ++ [0]
  sumDiff <- newIORef (0 :: Int)
  forM_ ([0..n] :: [Int]) $ \i ->
    modifyIORef sumDiff (+ diffAbs as i (i + 1))
  sumDiff <- readIORef sumDiff
  print sumDiff
  forM_ ([1..n] :: [Int]) $ \i -> do
    ans <- newIORef 0
    modifyIORef ans (+ (sumDiff - diffAbs as (i - 1) i - diffAbs as i (i + 1) + diffAbs as (i - 1) (i + 1)))
    print =<< readIORef ans

diffAbs :: [Int] -> Int -> Int -> Int
diffAbs xs i j = abs $ xs !! i - xs !! j