read N
read A

#全てのスポットを回った場合の交通費の算出
all=( $(echo $A | sed -e "s/-*[0-9]*/-\0%\0/g" -e "s/ //g" -e "s/%/ /g") )
total=0
for ((i=0; i<=N; i++)); do
  all[i]=$(( sum = (${all[i]}) ))
  all[i]=${all[i]/-/}
  (( total += (${all[i]}) ))
done

#取りやめた場合の交通費の算出
A=($A)

#最初
echo $(( total - ${all[0]} - ${all[1]} + ${A[1]/-/} ))

#中間
for (( k=2; k<N; k++ )); do
  (( a = total - (${all[k-1]}+${all[k]}), c = ${A[k-2]}-${A[k]}, ret1 = a + (c>0?c:(c)*-1) ))
  echo $ret1
done

#最後
echo $(( total - ${all[-2]} - ${A[-1]/-/} + ${A[-2]/-/} ))
