read N
read A

all=( $(echo $A | sed -e "s/-*[0-9]*/-\0%\0/g" -e "s/ //g" -e "s/%/ /g") )
route=( 0 $A 0 )

total=0
for i in $( seq 0 $N ); do

  #全てのスポットを回った場合の交通費の算出
  (( sum = (${all[i]}) ))
  (( total += ${sum/-/} ))

  #取りやめた場合の差分の算出
  (( a=(${all[i]}), b=(${all[i+1]:-0}), c=(${route[i]} - ${route[i+2]:-0}) ))
  (( sabun[i] = 0 - ${a/-/} - ${b/-/} + ${c/-/} ))

done

#それぞれの交通費を算出して表示
for i in $( seq 1 $N ); do
  echo $(( $total + ${sabun[i-1]} ))
done