CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.append(0)
A.insert(0,0)

total = 0
for i in range(1,N+2):
    total += abs(A[i]-A[i-1])

for i in range(1,N+1):
    print((total - abs(A[i+1]-A[i]) - abs(A[i]-A[i-1]) + abs(A[i+1]-A[i-1])))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

A.insert(0,0)
A.append(0)
cost = [0]*(N+1)
for i in range(N+1):
    cost[i] = abs(A[i+1]-A[i])

total = sum(cost)

for i in range(N):
    print((total - cost[i] - cost[i+1] + abs(A[i+2]-A[i])))
# Original solution
from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
A.appendleft(0)
A.append(0)
ans = 0
for i in range(1, n+2):
    ans+=abs(A[i]-A[i-1])
for i in range(1, n+1):
    d = abs(A[i]-A[i-1])+abs(A[i+1]-A[i])
    print((ans-d+abs(A[i-1]-A[i+1])))


# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
A.append(0)
A.insert(0, 0)
ans = 0
for i in range(1, n+2):
    ans+=abs(A[i]-A[i-1])
for i in range(1, n+1):
    d = abs(A[i]-A[i-1])+abs(A[i+1]-A[i])
    print((ans-d+abs(A[i-1]-A[i+1])))
# Original solution
from collections import deque

n = int(eval(input()))
a = deque(list(map(int, input().split())))
a.appendleft(0)
a.append(0)
a = list(a)
kaisa = deque()
ans = list()

for i in range(len(a)):
    if i == 0:
        continue
    diff = a[i] - a[i - 1]
    kaisa.append(diff)

for i in range(n):
    ans = list(kaisa).copy()
    new_num = kaisa[i] + kaisa[i + 1]
    ans.remove(kaisa[i])
    ans.remove(kaisa[i + 1])
    ans.insert(i, new_num)
    print((sum([abs(n) for n in ans])))


# Optimized solution
from collections import deque

n = int(eval(input()))
a = deque(list(map(int, input().split())))
a.appendleft(0)
a.append(0)

sum = sum([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)])
ans = 0

for i in range(n):
    ans = sum
    ans = ans - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - a[i])
    print(ans)
# Original solution
N = int(eval(input()))
an = [0] + [int(i) for i in input().split()]+[0]
t = sum([abs(an[i+1]-an[i]) for i in range(N+1)])
ts = []
for i in range(N):
  a,b,c = an[i:i+3]
  ts.append(t+(0 if 0 <= (a-b)*(b-c) else -2*(min(abs(a-b),abs(b-c)))))
print(('\n'.join(map(str,ts))))


# Optimized solution
N = int(eval(input()))
an = [0] + [int(i) for i in input().split()]+[0]
cn = [abs(an[i+1]-an[i]) for i in range(N+1)]
ct = sum(cn)
cs = [ct-cn[i]-cn[i+1]+abs(an[i]-an[i+2]) for i in range(N)]
print(('\n'.join(map(str,cs))))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.append(0)
a.insert(0,0)
diff=[]
for i in range(0,n+1):
	diff.append(a[i+1]-a[i])
for i in range(0,n):
	ans = 0
	for j in range(0,n+1):
		if j==i+1:
			continue
		if j==i:
			ans+=abs(diff[j]+diff[j+1])
		else:
			ans+=abs(diff[j])
	print(ans)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.append(0)
a.insert(0,0)
diff=[]
sum=0
for i in range(0,n+1):
	diff.append(a[i+1]-a[i])
	sum+=abs(diff[i])
for i in range(0,n):
	ans=sum+abs(diff[i]+diff[i+1])-(abs(diff[i])+abs(diff[i+1]))
	print(ans)
# Original solution
import copy
N = int(eval(input()))
A = list(map(int, input().split()))

for i in range(N):
    route = copy.deepcopy(A)
    route.pop(i)
    route.insert(0,0)
    route.append(0)
    #print(route)
    dist = 0
    for j in range(N):
        dist += abs(route[j]-route[j+1])
    print(dist)


# Optimized solution
import copy
N = int(eval(input()))
A = list(map(int, input().split()))
A.append(0)
A.insert(0,0)
dist = 0
for j in range(N+1):
    dist += abs(A[j]-A[j+1])
for j in range(N):
    res = dist + abs(A[j+2]-A[j]) - abs(A[j+1]-A[j]) - abs(A[j+2]-A[j+1])
    print(res)
# Original solution
import math

place_count = int(eval(input()))
position_list = input().split()

now_position = 0
cost = 0
cost_dict = {}

for skip_position in position_list:
	if skip_position in cost_dict:
		print((cost_dict[skip_position]))
	skip_position = int(skip_position)
	for next_position in position_list:
		next_position = int(next_position)
		if skip_position == next_position:
			continue
		cost += abs(next_position - now_position)
		now_position = next_position
	cost += abs(now_position)
	print(cost)
	cost_dict[skip_position] = cost
	now_position = 0
	cost = 0


# Optimized solution
place_count = int(eval(input()))
position_list = [0] + list(map(int, input().split()))
position_list.append(0)

all_sum = 0

for i in range(0, place_count+1):
	all_sum += abs(position_list[i+1] - position_list[i])

for x in range(1, place_count+1):
	print((all_sum - abs(position_list[x-1] - position_list[x]) - abs(position_list[x+1] - position_list[x]) + abs(position_list[x+1] - position_list[x-1])))
# Original solution
n = int(eval(input()))
alist = [0] + list(map(int, input().split()))
total = 0
for i in range(n):total += abs(alist[i]-alist[i+1])
total += abs(alist[-1])

for i in range(1,n):
  print((total-abs(alist[i]-alist[i-1])-abs(alist[i+1]-alist[i])+ abs(alist[i+1]-alist[i-1])))
print((total-abs(alist[-1]-alist[-2])-abs(alist[-1]-alist[0])+abs(alist[-2]-alist[0])))

# Optimized solution
N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
costs = [0] + [abs(A[i] - A[i+1]) for i in range(N+1)]
sum_costs = sum(costs)

for i in range(1, N+1):
    print((sum_costs - costs[i] - costs[i+1] + abs(A[i-1] - A[i+1])))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
result_1 = []
result_1.append(abs(a[0]))
for i in range(n-1):
    result_1.append(abs(a[i+1]-a[i]))
result_1.append(abs(a[n-1]))
a.insert(0,0)
a.insert(n+1,0)
for i in range(n):
    if a[i+2] >= a[i+1] >= a[i]:
        print((sum(result_1)))
    elif a[i+2] <= a[i+1] <= a[i]:
        print((sum(result_1)))
    else:
        b = abs(a[i+2]-a[i+1])
        c = abs(a[i+1]-a[i])
        d = abs(a[i+2]-a[i])
        result = sum(result_1) - (b + c - d)
        print(result)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
result_1 = 0
result_1 += abs(a[0])
for i in range(n-1):
    result_1 += abs(a[i+1]-a[i])
result_1 += abs(a[n-1])
a.insert(0,0)
a.insert(n+1,0)
for i in range(n):
    if a[i+2] >= a[i+1] >= a[i] or a[i+2] <= a[i+1] <= a[i]:
        print(result_1)
    else:
        b = abs(a[i+2]-a[i+1])
        c = abs(a[i+1]-a[i])
        d = abs(a[i+2]-a[i])
        result = result_1 - (b + c - d)
        print(result)
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]

for i in range(len(a)):
    a_pop = [0] + a[0:i] + a[i+1:len(a)] + [0]
    ans = 0
    for i in range(len(a_pop)-1):
        ans += abs(a_pop[i+1] - a_pop[i])
    print(ans)

# Optimized solution
n = int(eval(input()))
a = [0] + [int(i) for i in input().split()] + [0]

total = 0
for i in range(len(a)-1):
    total += abs(a[i+1] - a[i])
    
for i in range(n):
    ans = total + abs(a[i+2]-a[i]) - abs(a[i+1] - a[i]) - abs(a[i+2] - a[i+1])
    print(ans)
# Original solution
N = int(eval(input()))
A = [0]+list(map(int, input().split()))+[0]
B=[]
for i in range(1, N+2):
    B.append(abs(A[i]-A[i-1]))
for i in range(N):
    print((sum(B)-B[i+1]-B[i]+abs(A[i+2]-A[i])))

# Optimized solution
N = int(eval(input()))
A = [0]+list(map(int, input().split()))+[0]
B=0
for i in range(1, N+2):
    B+=(abs(A[i]-A[i-1]))
for i in range(N):
    print((B-abs(A[i+1]-A[i])-abs(A[i+2]-A[i+1])+abs(A[i+2]-A[i])))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

A.append(0)
A.insert(0,0)

D = 0
for i in range(N+1):
  D += abs(A[i+1]-A[i])

for i in range(1, N+1):
  print((D - abs(A[i]-A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i+1]-A[i-1]) ))

# Optimized solution

N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]

B = []

for i in range(1, N+2):
  x = abs(A[i] - A[i-1])
  B.append(x)

distance = sum(B)

for i in range(1, N+1):
  sub = B[i-1] + B[i]
  add = abs(A[i+1] - A[i-1])
  print((distance - sub + add))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
Sum = 0
a.insert(0, 0)
a.append(0)
s = []
b = []
for i in range(len(a) - 1):
    b.append(abs(a[i] - a[i + 1]))
for i in range(len(b) - 1):
    ans = sum(b) - (b[i] + b[i + 1]) + abs(a[i] - a[i + 2])
    print(ans)


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
Sum = 0
a.insert(0, 0)
a.append(0)
s = []
b = []
for i in range(len(a) - 1):
    b.append(abs(a[i] - a[i + 1]))
Sum_b = sum(b)
for i in range(len(b) - 1):
    ans = Sum_b - (b[i] + b[i + 1]) + abs(a[i] - a[i + 2])
    print(ans)
# Original solution
import sys
import copy
input = sys.stdin.readline

N = int(eval(input()))
A = list(map(int,input().split()))
b = [0]
for i in range(N):
    b.append(A[i])
b.append(0)

for i in range(1,N+1):
    c = copy.copy(b)
    sum_c = 0
    del c[i]
    for j in range(1,len(c)):
        sum_c += abs(c[j]-c[j-1])
    print(sum_c)
    



# Optimized solution
import sys
import copy
input = sys.stdin.readline

N = int(eval(input()))
A = list(map(int,input().split()))
b = [0]
for i in range(N):
    b.append(A[i])
b.append(0)

sumb= 0
for i in range(1,len(b)):
    sumb += abs(b[i]-b[i-1])

for j in range(1,N+1):
    sumc = sumb
    sumc = sumc - abs(b[j+1]-b[j])-abs(b[j]-b[j-1])+abs(b[j+1]-b[j-1])
    print(sumc)
# Original solution
import copy

N = int(eval(input()))
cost = list(map(int,input().split()))
for i in range(N):
    ans = 0
    temp_cost = cost.copy()
    temp_cost.pop(i)
    ans += abs(temp_cost[0]) + abs(temp_cost[-1])
    for i in range(0,N-2):
        ans += abs(temp_cost[i] - temp_cost[i+1])
        
    print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.insert(0,0)
a.insert(n+1,0)
total = 0
for i in range(n+1):
    total += abs(a[i+1] - a[i])
for i in range(1, n+1):
    print((total + abs(a[i+1] - a[i-1]) - abs(a[i+1] - a[i]) - abs(a[i-1] - a[i])))
# Original solution
n,*a=list(map(int,open(0).read().split()))
a=[0]+a+[0]
c=sum(abs(j-i)for i,j in zip(a,a[1:]))
for i,j,k in zip(a,a[1:],a[2:]):print((c-abs(j-i)-abs(k-j)+abs(k-i)))

# Optimized solution
n,*a=list(map(int,open(0).read().split()))
a=[0]+a+[0]
A=abs
c=sum(A(j-i)for i,j in zip(a,a[1:]))
for i,j,k in zip(a,a[1:],a[2:]):print((c-A(j-i)-A(k-j)+A(k-i)))
# Original solution
n,*a=list(map(int,open(0).read().split()))
a=[0]+a+[0]
A=abs
c=sum(A(j-i)for i,j in zip(a,a[1:]))
for i,j,k in zip(a,a[1:],a[2:]):print((c-A(j-i)-A(k-j)+A(k-i)))

# Optimized solution
_,a=open(0)
a=[0]+list(map(int,a.split()))+[0]
A=abs
c=sum(A(j-i)for i,j in zip(a,a[1:]))
for i,j,k in zip(a,a[1:],a[2:]):print((c-A(j-i)-A(k-j)+A(k-i)))
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))
for i in range(n):
    visit = A[:i ] + A[i + 1 :]
    visit = [0] + visit + [0]
    cost = [abs(visit[i] - visit[i - 1]) for i in range(1, len(visit))]
    print((sum(cost)))

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
plan = [0] + A + [0]
cost = sum([abs(plan[i] - plan[i - 1]) for i in range(1, len(plan))])

for i in range(1, n + 1):
    diff = (abs(plan[i - 1] - plan[i]) + abs(plan[i] - plan[i + 1])) - abs(plan[i - 1] - plan[i + 1])
    print((cost - diff))
# Original solution
N = int(eval(input()))
A_list = [0]
A_list.extend(list(map(int, input().split())))
A_list.append(0)
previous_val = 0
dif = []
for i in A_list[1:]:
    dif.append(previous_val - i)
    previous_val = i

for idx, val in enumerate(dif):
    if idx < len(dif)-1:
        tmp1 = dif[idx]
        tmp2 = dif[idx + 1]
        dif[idx] = 0
        dif[idx + 1] = 0
        print((sum(map(abs, dif)) + abs(tmp1 + tmp2)))
        dif[idx] = tmp1
        dif[idx + 1] = tmp2


# Optimized solution
N = int(eval(input()))
A_list = [0]
A_list.extend(list(map(int, input().split())))
A_list.append(0)
previous_val = 0
S = 0
for i in A_list[1:]:
    S += abs(previous_val - i)
    previous_val = i

for idx, val in enumerate(A_list):
    if idx == 0 or idx == (len(A_list) - 1):
        continue
    else:
        new_dif = abs(A_list[idx - 1] - A_list[idx + 1])
        old_dif = abs(A_list[idx - 1] - A_list[idx]) + abs(A_list[idx] - A_list[idx + 1])
        print((S + new_dif - old_dif))
# Original solution
def abc092_c():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    for i in range(n):
        tmp_a = a.copy()
        del tmp_a[i]
        money = abs(tmp_a[0]) + abs(tmp_a[-1])
        for j in range(n - 2):
            money += abs(tmp_a[j] - tmp_a[j + 1])
        print(money)


abc092_c()

# Optimized solution
def abc092_c():
    n = int(eval(input()))
    a = [0] + list(map(int, input().split())) + [0]
    money = 0
    for i in range(n + 1):
        money += abs(a[i] - a[i + 1])
    for i in range(1, n+1):
        print((money - abs(a[i] - a[i - 1]) - abs(a[i] - a[i + 1]) + abs(a[i + 1] - a[i - 1])))


abc092_c()
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))

a.insert(0,0)
a.append(0)

all_sum = 0
for i in range(0,N+1):
    all_sum += abs(a[i+1] - a[i])


for i in range(1, N+1):
    if a[i-1] <= a[i] <= a[i+1] or a[i-1] >= a[i] >= a[i+1]:
        print(all_sum)
    elif a[i-1] <= a[i]  and a[i-1] >=  a[i+1]:
        #増減
        print((all_sum - abs(a[i] - a[i-1]) * 2))
    elif  a[i-1] <= a[i]  and a[i-1] <= a[i+1]:
        #増減
        print((all_sum - abs(a[i] - a[i+1]) * 2))
    elif a[i-1] >= a[i]  and a[i-1] >=  a[i+1]:
        #減増
        print((all_sum - abs(a[i] - a[i+1]) * 2))
    elif a[i-1] >= a[i]  and a[i-1] <=  a[i+1]:
        #減増
        print((all_sum - abs(a[i] - a[i-1]) * 2))
    else:
        print((i, "yukkuri"))

# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))

a.insert(0,0)
a.append(0)

all_sum = 0
for i in range(0,N+1):
    all_sum += abs(a[i+1] - a[i])


for i in range(1, N+1):
    print((all_sum - (abs(a[i-1] - a[i]) + abs(a[i+1] - a[i])) + abs(a[i+1] - a[i-1])))
# Original solution
n = int(eval(input()))
*a, = list(map(int, input().split()))

a.insert(0, 0)
a.append(0)

d = [0]*(len(a)-1)
for i in range(len(a)-1):
    d[i] = abs(a[i]-a[i+1])

for i in range(len(d)-1):
    print((sum(d[:i]) + sum(d[i+2:]) + abs(a[i] - a[i+2])))


# Optimized solution
n = int(eval(input()))
*a, = list(map(int, input().split()))

a.insert(0, 0)
a.append(0)

s = 0
for i in range(len(a)-1):
    s += abs(a[i]-a[i+1])

for i in range(1, len(a)-1):
    print((s + abs(a[i-1]-a[i+1]) - (abs(a[i-1]-a[i]) + abs(a[i]-a[i+1]))))
# Original solution
# your code goes here
N = int(eval(input()))
point = list(map(int,input().split()))

for i in range(N):
	prev = 0
	ans = 0
	for j in range(N):
		if j == i:
			continue
		ans += abs(point[j] - prev)
		prev = point[j]
	ans += abs(prev)
	print(ans)

# Optimized solution
# your code goes here
N = int(eval(input()))
point = [0]
point.extend(list(map(int,input().split())))
point.append(0)

total = 0
for i in range(1,N+2):
	total += abs(point[i] - point[i-1])

for i in range(1,N+1):
	ans = total - abs(point[i]-point[i-1]) - abs(point[i+1]-point[i]) + abs(point[i+1]-point[i-1])
	print(ans)
# Original solution
n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]

D = [abs(A[i+1]-A[i]) for i in range(len(A)-1)]
base = sum(D)

for i in range(n):
  print((base-D[i]-D[i+1]+abs(A[i+2]-A[i])))

# Optimized solution
N = int(eval(input()))
A = [0]+list(map(int,input().split()))+[0]
B = [abs(a-b) for a,b in zip(A,A[1:])]
C = sum(B)

for n in range(N):
  print((C+abs(A[n]-A[n+2])-(B[n]+B[n+1])))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
a = [0] + a + [0]
cost = []
for i in range(n + 1):
    cost.append(abs(a[i + 1] - a[i]))
for i in range(n):
    ans = abs(a[i + 2] - a[i])
    ans += sum(cost[:i]) + sum(cost[i + 2:])
    print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
a = [0] + a + [0]
cost = []
for i in range(n + 1):
    cost.append(abs(a[i + 1] - a[i]))
cost_t = [0]
for i in range(n + 1):
    cost_t.append(cost[i] + cost_t[i])
for i in range(n):
    ans = abs(a[i + 2] - a[i])
    ans += cost_t[i] + cost_t[-1] - cost_t[i + 2]
    print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))


for i in range(N):
    ans = 0
    pos = 0
    for j in range(len(A)):
        if j == i:
            continue
        ans += abs(A[j]-pos)
        #print('ans', ans)#debug
        pos = A[j]
        #print('pos:', pos)#debug
    ans += abs(pos)
    print(ans)

# Optimized solution
N = int(eval(input()))
A = [0]

Astr = input().split()

for i in Astr:
    A.append(int(i))

A.append(0)

ans = 0
pos = 0
for i in range(len(A)):
    if i == 0:
        continue
    ans += abs(A[i]-pos)
    pos = A[i]

for i in range(len(A)):
    if i == 0 or i == len(A)-1:
        continue
    print((ans-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])))
# Original solution
n = int(eval(input()))
arr = list(map(int,input().split()))
arr.insert(0,0)
arr.append(0)
ans = 0
tmp = 0
for i in range(1,n + 1):
    for j in range(1,len(arr)):
        if i != j:
            ans += abs(arr[j] - tmp)
            tmp = arr[j]
    print(ans)
    ans = 0

# Optimized solution
n = int(eval(input()))
arr = [0] + list(map(int,input().split())) + [0]
tmp= [ abs(arr[i] - arr[i + 1]) for i in range(len(arr) - 1)]
_sum = sum(tmp)
for i in range(n):
    ans = _sum - tmp[i] - tmp[i + 1] + abs(arr[i + 2] - arr[i])
    print(ans)
# Original solution
def cost(a):
    prev = 0
    total = 0
    for ai in a:
        total += abs(ai - prev)
        prev = ai
    total += abs(0 - prev)
    return total

def cancel(a, i, total_cost):
    prev_spot = a[i-1]
    spot = a[i]
    next_spot = a[i+1]
    if spot >= min(prev_spot, next_spot) and spot <= max(prev_spot, next_spot):
        return total_cost
    else:
        if (next_spot >= prev_spot and spot < prev_spot) or (next_spot <= prev_spot and spot > prev_spot):
            return total_cost - 2 * abs(prev_spot - spot)
        if (next_spot >= prev_spot and spot > next_spot) or (next_spot <= prev_spot and spot < next_spot):
            return total_cost - 2 * abs(next_spot - spot)
        
    
if __name__ == '__main__':
    _ = int(eval(input()))
    a = [0] + list(map(int, input().split()))
    a.append(0)
    no_cancellations = cost(a)
    for i in range(1, len(a)-1):
        print((cancel(a, i, no_cancellations)))

# Optimized solution
def cost(a):
    total = 0
    for i in range(1, len(a)):
        total += abs(a[i] - a[i-1])
    return total

def cancel(a, i, total):
    prev = a[i-1]
    spot = a[i]
    nxt = a[i+1]
    if (nxt >= prev and spot < prev) or (nxt <= prev and spot > prev):
        return total - 2 * abs(prev - spot)
    if (nxt >= prev and spot > nxt) or (nxt <= prev and spot < nxt):
        return total - 2 * abs(nxt - spot)
    return total
        
    
if __name__ == '__main__':
    _ = int(eval(input()))
    a = [0] + list(map(int, input().split()))
    a.append(0)
    total = cost(a)
    for i in range(1, len(a)-1):
        print((cancel(a, i, total)))
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
A.append(0)
total = abs(A[0])
for i in range(N):
    total += abs(A[i + 1] - A[i])

for i in range(N):
    dif = 0
    if i == 0:
        dif = abs(A[1] - A[0]) + abs(A[0]) - abs(A[1])
    else:
        dif = abs(A[i + 1] - A[i]) + abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i - 1])
    print((total - dif))


# Optimized solution
N = int(eval(input()))
A = [0] + [int(i) for i in input().split()] + [0]
total = 0
for i in range(len(A) - 1):
    total += abs(A[i + 1] - A[i])
for i in range(1, len(A) - 1):
    print((
        total - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1])
    ))
# Original solution
# -*- coding: utf-8 -*-

N = int(eval(input()))

a = [i for i in map(int, input().split())]

total = []
x = 0
skip_total = []
for i in range(N-1):
    total.append(abs(a[i] - x))
    skip_total.append(abs(a[i+1] - x))
    x = a[i]
skip_total.append(abs(x - 0))
total.append(abs(a[N-1] - x))
x = a[N-1]
total.append(abs(x - 0))

print((skip_total[0] + sum(total[2:])))
for i in range(1, N-1):
    print((sum(total[0:i]) + skip_total[i] + sum(total[i+2:])))
print((sum(total[0:N-1]) + skip_total[N-1]))


# Optimized solution
# -*- coding: utf-8 -*-

N = int(eval(input()))

a = [i for i in map(int, input().split())]

a = [0] + a + [0]

total = 0
for i in range(N+1):
    total += abs(a[i] - a[i+1])

for i in range(1, N+1):
    print((total + abs(a[i-1] - a[i+1]) - (abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]))))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

for i in range(n):
    temp = [0] + a[:i] + a[i+1:] + [0]
    ans = 0
    for i in range(len(temp)-1):
        ans += abs(temp[i+1] - temp[i])
    print(ans)

# Optimized solution
n = int(eval(input()))
a = [0] + list(map(int, input().split())) + [0]

b = [0]

for i in range(len(a)-1):
    b.append(abs(a[i+1]-a[i]) + b[-1])

s = b[-1]

for i in range(1, len(a)-1):
    ans = s - abs(a[i] - a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i+1] - a[i-1])
    print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.insert(0,0)
a.append(0)
for i in range(n):
    m=0
    b = list(a)
    del b[i+1]
    for j in range(n):
        m += abs(b[j]-b[j+1])
    print(m)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.insert(0,0)
a.append(0)
cost = 0
for i in range(n+1):
    cost += abs(a[i]-a[i+1])
for i in range(1,n+1):
    print((cost-(abs(a[i-1]-a[i])+abs(a[i]-a[i+1]))+abs(a[i-1]-a[i+1])))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))

money = 0
for i in range(n-1):
  money += abs(a[i+1]-a[i])
money += abs(a[0])+abs(a[-1])


print((money - abs(a[0]) - abs(a[0]-a[1]) + abs(a[1])))
for i in range(1,n-1):
  print((money - abs(a[i]-a[i-1]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1])))
print((money - abs(a[-1]) - abs(a[-1]-a[-2]) + abs(a[-2])))

# Optimized solution
n = int(eval(input()))
a = [0]+list(map(int,input().split()))+[0]

money = 0
for i in range(n+1):
  money += abs(a[i+1]-a[i])

for i in range(1,n+1):
  print((money - abs(a[i]-a[i-1]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1])))
# Original solution
def main():
    N = int(eval(input()))
    A = [0] + [int(i) for i in input().split()] + [0]
    l = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    print(("\n".join(
        [str(sum(l) - l[i] - l[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)])))

    return


main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = [0] + [int(i) for i in input().split()] + [0]
    l = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    num = sum(l)
    print(("\n".join(
        [str(num - l[i] - l[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)])))

    return


main()
# Original solution
input = open(0).read

N, *A = [int(i) for i in input().split()]


def main():
    l = [abs(A[i + 1] - A[i]) for i in range(N - 1)]

    num = sum(l)

    print((num - l[0] + abs(A[1]) + abs(A[-1])))

    if N != 2:
        print(("\n".join(
            [str(num - l[i] - l[i + 1]
                 + abs(A[i] - A[i + 2])
                 + abs(A[0]) + abs(A[-1])) for i in range(N - 2)])))

    print((num - l[-1] + abs(A[0]) + abs(A[-2])))
    return


main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = [0] + [int(i) for i in input().split()] + [0]
    d = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    num = sum(d)
    print(("\n".join(
        [str(num - d[i] - d[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)])))

    return


main()
# Original solution
n=int(eval(input()))
A=[0]+list(map(int,input().split()))+[0]
for i in range(n):
  B=A[:i+1]+A[i+2:]
  print((sum(abs(B[j]-B[j+1]) for j in range(n))))

# Optimized solution
n=int(eval(input()))
A=[0]+list(map(int,input().split()))+[0]
S=sum(abs(A[j]-A[j+1]) for j in range(n+1))
for i in range(n):
  if (A[i+1]-A[i])*(A[i+2]-A[i+1])>=0:
    print(S)
  else:
    print((S-abs(A[i+1]-A[i])-abs(A[i+2]-A[i+1])+abs(A[i+2]-A[i])))