f ::[Int]->Int->Int->[Int]
f [] _ _=[]
f (x:xs) old len=let len2=len + (abs(x-old))
                 in len2: f xs x len2

f2 ::[Int]->[Int]->Int->Int->[Int]
f2 [] _ _ _=[]
f2 (x:[]) _ len old=[len+(abs old)]
f2 (x:x2:xs) (y:y2:ys) len old=let len2=len+ (abs (x2-old))+y
                                   len3=len+ (abs (x-old))
                               in len2 : f2 (x2:xs) (y2:ys) len3 x
main = do
       e<-getLine
       e2<-getLine
       let xs=map read (words e2)::[Int]
           zs=tail $ reverse $ [read "0"::Int] ++ (f (reverse xs) 0 0)
       mapM_ putStrLn $ map show $ f2 xs zs 0 0