There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.
Spot i is at the point with coordinate A_i.
It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.
You planned a trip along the axis.
In this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.
However, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.
You will visit the remaining spots as planned in the order they are numbered.
You will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.
For each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.

-----Constraints-----
 - 2 \leq N \leq 10^5
 - -5000 \leq A_i \leq 5000 (1 \leq i \leq N)
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 A_2 ... A_N

-----Output-----
Print N lines.
In the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.

-----Sample Input-----
3
3 5 -1

-----Sample Output-----
12
8
10

Spot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.
For each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:
 - For i = 1, the course of the trip is 0 \rightarrow 5 \rightarrow -1 \rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.
 - For i = 2, the course of the trip is 0 \rightarrow 3 \rightarrow -1 \rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.
 - For i = 3, the course of the trip is 0 \rightarrow 3 \rightarrow 5 \rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.

Source: atcoder | Difficulty: EASY


Solutions:
N = int(input())
A = list(map(int, input().split()))
SUM = abs(A[0])
for i in range(N):
	if i < N - 1:
		SUM += abs(A[i + 1] - A[i])
	else:
		SUM += abs(0 - A[i])
now = 0
for i in range(N):
	if i != N - 1:
		diff = abs(A[i + 1] - now) - abs(A[i] - now) - abs(A[i + 1] - A[i])
		now = A[i]
	else:
		diff = abs(0 - now) - abs(A[i] - now) - abs(0 - A[i])
	print(SUM + diff)


n = int(input())
A = [0] + list(map(int, input().split())) + [0]
cost = 0
for i in range(n + 1):
	cost += abs(A[i] - A[i + 1])
for i in range(1, n + 1):
	ans = cost
	ans -= abs(A[i] - A[i - 1])
	ans -= abs(A[i] - A[i + 1])
	ans += abs(A[i - 1] - A[i + 1])
	print(ans)


N = int(input())
A = list(map(int, input().split()))
A.append(0)
A.insert(0, 0)
S = 0
for i in range(len(A) - 1):
	S += abs(A[i + 1] - A[i])
for i in range(1, N + 1):
	print(S - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1]))


n = int(input())
a = list(map(int, input().split()))
d = 0
a = [0] + a + [0]
for j in range(len(a) - 1):
	d += abs(a[j] - a[j + 1])
for i in range(1, len(a) - 1):
	if a[i - 1] <= a[i] <= a[i + 1] or a[i - 1] >= a[i] >= a[i + 1]:
		print(d)
	else:
		print(d - abs(a[i - 1] - a[i]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1]))


N = int(input())
A = list(map(int, input().split()))
j = abs(A[0]) + abs(A[N - 1])
for i in range(N - 1):
	j += abs(A[i] - A[i + 1])
for i in range(N):
	if i == 0:
		ans = j - abs(A[0]) - abs(A[0] - A[1]) + abs(A[1])
	elif i == N - 1:
		ans = j - abs(A[N - 2] - A[N - 1]) - abs(A[N - 1]) + abs(A[N - 2])
	else:
		ans = j - abs(A[i] - A[i - 1]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1])
	print(ans)


n = int(input())
arr = [0] + list(map(int, input().split())) + [0]
sum_arr = sum((abs(arr[i] - arr[i + 1]) for i in range(n + 1)))
for i in range(1, n + 1):
	diff = abs(arr[i - 1] - arr[i]) + abs(arr[i] - arr[i + 1]) - abs(arr[i - 1] - arr[i + 1])
	print(sum_arr - diff)


n = int(input())
c = list(map(int, input().split()))
c = [0] + c + [0]
ans = 0
for i in range(n + 1):
	ans += abs(c[i + 1] - c[i])
for i in range(n):
	d = abs(c[i + 1] - c[i]) + abs(c[i + 2] - c[i + 1])
	e = abs(c[i + 2] - c[i])
	print(ans - d + e)


n = int(input())
spot = [0] + list(map(int, input().split())) + [0]
plst = [0] * n
dissum = 0
for i in range(1, n + 1):
	plst[i - 1] = abs(spot[i + 1] - spot[i - 1]) - (abs(spot[i + 1] - spot[i]) + abs(spot[i] - spot[i - 1]))
	dissum += abs(spot[i] - spot[i - 1])
dissum += abs(spot[n])
for i in range(n):
	print(dissum + plst[i])


n = int(input())
l = [0] + list(map(int, input().split())) + [0]
d = [abs(a - b) for (a, b) in zip(l, l[1:])]
m = sum(d)
for i in range(n):
	print(m + abs(l[i] - l[i + 2]) - (d[i] + d[i + 1]))


n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
tnp = 0
for i in range(1, n + 2):
	tnp += abs(a[i] - a[i - 1])
for i in range(n):
	ans = tnp - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - a[i])
	print(ans)


import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal

def s():
	return input()

def i():
	return int(input())

def S():
	return input().split()

def I():
	return map(int, input().split())

def L():
	return list(input().split())

def l():
	return list(map(int, input().split()))

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 9
mod = 10 ** 9 + 7
N = i()
A = [0] + l() + [0]
d = []
for i in range(N + 1):
	d.append(abs(A[i + 1] - A[i]))
ans = sum(d)
for i in range(N):
	print(ans + abs(A[i] - A[i + 2]) - d[i] - d[i + 1])


N = int(input())
A = list((int(a) for a in input().split()))
A = [0] + A + [0]
dist = [0]
for i in range(1, N + 2):
	dist.append(abs(A[i] - A[i - 1]))
dist_cum = [0] * (N + 2)
for i in range(N + 1):
	dist_cum[i + 1] = dist_cum[i] + dist[i + 1]
for i in range(1, N + 1):
	if A[i - 1] < A[i] and A[i] < A[i + 1]:
		print(dist_cum[-1])
	elif A[i - 1] > A[i] and A[i] > A[i + 1]:
		print(dist_cum[-1])
	else:
		tmp = dist_cum[i - 1]
		tmp += dist_cum[-1] - dist_cum[i + 1]
		tmp += abs(A[i + 1] - A[i - 1])
		print(tmp)


N = int(input())
A = list(map(int, input().split()))
B = A[:]
B.insert(0, 0)
B.append(0)
sum = 0
for i in range(N + 1):
	sum += abs(B[i + 1] - B[i])
for i in range(N):
	x = abs(B[i + 1] - B[i]) + abs(B[i + 2] - B[i + 1])
	y = abs(B[i + 2] - B[i])
	print(sum - x + y)


n = int(input())
a = list(map(int, input().split()))
a.insert(n, 0)
a.insert(0, 0)
t = 0
tmp = 0
for i in range(n + 1):
	t += abs(a[i + 1] - a[i])
for i in range(1, n + 1):
	tmp = t
	tmp -= abs(a[i] - a[i - 1]) + abs(a[i + 1] - a[i])
	tmp += abs(a[i + 1] - a[i - 1])
	print(tmp)


n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
max_fee = 0
for i in range(1, n + 2):
	max_fee += abs(a[i] - a[i - 1])
for i in range(1, n + 1):
	res = max_fee - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1])
	print(res)


def main():
	n = int(input())
	inlis = list(map(int, input().split()))
	total = 0
	mae = 0
	for i in range(n):
		total += abs(inlis[i] - mae)
		mae = inlis[i]
	total += abs(inlis[-1])
	inlis.append(0)
	if 0 <= inlis[0] and inlis[0] > inlis[1]:
		if inlis[1] > 0:
			print(total - 2 * abs(inlis[1] - inlis[0]))
		else:
			print(total - 2 * abs(inlis[0]))
	elif 0 >= inlis[0] and inlis[0] < inlis[1]:
		if inlis[1] < 0:
			print(total - 2 * abs(inlis[1] - inlis[0]))
		else:
			print(total - 2 * abs(inlis[0]))
	else:
		print(total)
	for j in range(1, n):
		if inlis[j - 1] <= inlis[j] <= inlis[j + 1] or inlis[j - 1] >= inlis[j] >= inlis[j + 1]:
			print(total)
		elif inlis[j - 1] <= inlis[j] and inlis[j] > inlis[j + 1]:
			if inlis[j - 1] >= inlis[j + 1]:
				print(total - 2 * abs(inlis[j - 1] - inlis[j]))
			else:
				print(total - 2 * abs(inlis[j + 1] - inlis[j]))
		elif inlis[j - 1] >= inlis[j] and inlis[j] < inlis[j + 1]:
			if inlis[j - 1] >= inlis[j + 1]:
				print(total - 2 * abs(inlis[j + 1] - inlis[j]))
			else:
				print(total - 2 * abs(inlis[j - 1] - inlis[j]))

def __starting_point():
	main()
__starting_point()


N = int(input())
X = list(map(int, input().split()))
X.append(0)
load = 0
now = 0
for i in range(N + 1):
	load += abs(X[i] - now)
	now = X[i]
now = 0
for i in range(N):
	if now <= X[i] <= X[i + 1]:
		print(load)
	elif X[i + 1] <= X[i] <= now:
		print(load)
	else:
		ll = 2 * min(abs(X[i] - now), abs(X[i] - X[i + 1]))
		print(load - ll)
	now = X[i]


n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
max_fee = 0
for i in range(1, n + 2):
	max_fee += abs(a[i] - a[i - 1])
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(max_fee)
	else:
		res = max_fee - min(abs(a[i + 1] - a[i]) * 2, abs(a[i] - a[i - 1]) * 2)
		print(res)


n = int(input())
al = list(map(int, input().split()))
res = 0
al.append(0)
al.insert(0, 0)
for i in range(n + 1):
	res += abs(al[i + 1] - al[i])
for j in range(1, n + 1):
	if (al[j + 1] - al[j]) * (al[j] - al[j - 1]) >= 0:
		print(res)
	else:
		print(res - min(abs(al[j + 1] - al[j]), abs(al[j] - al[j - 1])) * 2)


import sys
stdin = sys.stdin

def ns():
	return stdin.readline().rstrip()

def ni():
	return int(stdin.readline().rstrip())

def nm():
	return list(map(int, stdin.readline().split()))

def nl():
	return list(map(int, stdin.readline().split()))

def main():
	n = ni()
	A = nl()
	total = sum([abs(A[i + 1] - A[i]) for i in range(n - 1)])
	for i in range(n):
		if i == 0:
			start = abs(A[1])
			end = abs(A[-1])
			print(total - abs(A[1] - A[0]) + start + end)
		elif i == n - 1:
			start = abs(A[0])
			end = abs(A[-2])
			print(total - abs(A[-2] - A[-1]) + start + end)
		else:
			start = abs(A[0])
			end = abs(A[-1])
			print(total - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i + 1] - A[i - 1]) + start + end)

def __starting_point():
	main()
__starting_point()


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
B = [0] * (N + 1)
total = 0
for i in range(N + 1):
	B[i] = A[i + 1] - A[i]
	total += abs(B[i])
for i in range(N):
	print(total - (abs(B[i]) + abs(B[i + 1])) + abs(B[i] + B[i + 1]))


from copy import deepcopy
n = int(input())
A = list(map(int, input().split()))
B = [0] + deepcopy(A) + [0]
total = 0
b = 0
for a in A:
	total += abs(a - b)
	b = a
total += abs(b)
for i in range(1, n + 1):
	(z, x, c) = (B[i - 1], B[i], B[i + 1])
	print(total - abs(x - z) - abs(c - x) + abs(c - z))


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.append(0)
	base = abs(a[0])
	for i in range(n):
		base += abs(a[i + 1] - a[i])
	ans = []
	for i in range(n):
		if (a[i] - a[i - 1]) * (a[i + 1] - a[i]) >= 0:
			ans.append(base)
		else:
			ans.append(base - 2 * min(abs(a[i] - a[i - 1]), abs(a[i + 1] - a[i])))
	for i in ans:
		print(i)
main()


N = int(input())
a = [0] + list(map(int, input().split())) + [0]
sm = 0
for i in range(1, N + 2):
	sm += abs(a[i - 1] - a[i])
for i in range(1, N + 1):
	print(sm - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1]))


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	(N, *A) = map(int, read().split())
	B = [0]
	B.extend(A)
	B.append(0)
	M = len(B)
	total = 0
	for i in range(M - 1):
		total += abs(B[i + 1] - B[i])
	ans = [0] * N
	for i in range(N):
		ans[i] = total - abs(B[i + 1] - B[i]) - abs(B[i + 2] - B[i + 1]) + abs(B[i + 2] - B[i])
	print(*ans, sep='\n')
	return

def __starting_point():
	main()
__starting_point()


n = int(input())
a = [0] + list(map(int, input().split())) + [0]
res = [0] * (n + 1)
for i in range(n + 1):
	res[i] = abs(a[i] - a[i + 1])
t = sum(res)
for i in range(1, n + 1):
	ans = t - (res[i - 1] + res[i]) + abs(a[i - 1] - a[i + 1])
	print(ans)


n = int(input())
a = [int(i) for i in input().split()]
a.append(0)
a.insert(0, 0)
cost = 0
for i in range(1, len(a)):
	cost += abs(a[i - 1] - a[i])
for i in range(1, len(a) - 1):
	if a[i - 1] < a[i] < a[i + 1]:
		ans = cost
	elif a[i - 1] > a[i] > a[i + 1]:
		ans = cost
	else:
		ans = cost - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])
	print(ans)


N = int(input())
A = list(map(int, input().split()))
A.append(0)
sum = 0
for i in range(N + 1):
	if i == 0:
		sum += abs(A[0])
	else:
		sum += abs(A[i - 1] - A[i])
for i in range(N):
	if i == 0:
		print(sum + (abs(A[1]) - abs(A[1] - A[0]) - abs(A[0])))
	else:
		print(sum + (abs(A[i + 1] - A[i - 1]) - abs(A[i + 1] - A[i]) - abs(A[i] - A[i - 1])))


n = int(input())
a = list(map(int, input().split()))
cost = abs(a[0])
for i in range(1, n):
	cost += abs(a[i] - a[i - 1])
cost += abs(a[-1])
ans = [0] * n
an = cost - abs(a[1] - a[0]) - abs(a[0]) + abs(a[1])
print(an)
for i in range(1, n - 1):
	key = cost - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])
	print(key)
print(cost - abs(a[-1]) + abs(a[-2]) - abs(a[-1] - a[-2]))


N = int(input())
A = [int(x) for x in input().split()]
A.insert(0, 0)
A.append(0)
cost = 0
for i in range(1, N + 2):
	cost += abs(A[i] - A[i - 1])

def change(i):
	nonlocal A
	return -abs(A[i + 1] - A[i]) - abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i - 1])
for i in range(1, N + 1):
	print(cost + change(i))


n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
total = 0
pre = 0
for i in a:
	total += abs(i - pre)
	pre = i
for i in range(1, len(a) - 1):
	print(total + abs(a[i + 1] - a[i - 1]) - abs(a[i] - a[i + 1]) - abs(a[i] - a[i - 1]))


n = int(input())
lst = list(map(int, input().split()))
s = 0
diff_lst = []
sign_lst = []
for i in lst + [0]:
	diff = i - s
	diff_lst.append(abs(diff))
	sign_lst.append(1) if diff > 0 else sign_lst.append(-1)
	s = i
su = sum(diff_lst)
for i in range(n):
	if sign_lst[i] * sign_lst[i + 1] > 0:
		print(su)
	else:
		print(su - diff_lst[i] - diff_lst[i + 1] + abs(diff_lst[i] - diff_lst[i + 1]))


input()
a = [0] + list(map(int, input().split())) + [0]
a = [j - i for (i, j) in zip(a, a[1:])]
x = sum((abs(i) for i in a))
for (i, j) in zip(a, a[1:]):
	if i * j >= 0:
		print(x)
	else:
		print(x - 2 * min(abs(i), abs(j)))


N = int(input())
(*A,) = map(int, input().split())
A = [0] + A + [0]
S = 0
for i in range(1, N + 2):
	S += abs(A[i] - A[i - 1])
for i in range(1, N + 1):
	new = abs(A[i - 1] - A[i + 1])
	pre_to_now = abs(A[i - 1] - A[i])
	now_to_next = abs(A[i] - A[i + 1])
	print(S - pre_to_now - now_to_next + new)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
S = sum((abs(A[i] - A[i + 1]) for i in range(N + 1)))
for i in range(1, N + 1):
	print(S - (abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i])) + abs(A[i + 1] - A[i - 1]))


n = int(input())
lis = [0] + list(map(int, input().split())) + [0]
s = 0
for i in range(n + 1):
	tmp = abs(lis[i] - lis[i + 1])
	s += tmp
for i in range(1, n + 1):
	ans = s + abs(lis[i - 1] - lis[i + 1]) - (abs(lis[i - 1] - lis[i]) + abs(lis[i] - lis[i + 1]))
	print(ans)


n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
s = 0
for i in range(len(a) - 1):
	s += abs(a[i] - a[i + 1])
for h in range(1, n + 1):
	t = abs(a[h + 1] - a[h - 1]) - abs(a[h] - a[h - 1]) - abs(a[h + 1] - a[h])
	print(s + t)


N = int(input())
A = [0] + [int(x) for x in input().split()] + [0]
ans = 0
for i in range(N + 1):
	ans += abs(A[i + 1] - A[i])
for i in range(1, N + 1):
	tmp = ans
	if A[i - 1] <= A[i] <= A[i + 1]:
		print(tmp)
	elif A[i - 1] >= A[i] >= A[i + 1]:
		print(tmp)
	else:
		tmp -= min(abs(A[i] - A[i - 1]), abs(A[i + 1] - A[i])) * 2
		print(tmp)


N = int(input())
A = list(map(int, input().split()))
full_root = [0] + A + [0]
full_place = [abs(full_root[i] - full_root[i + 1]) for i in range(N + 1)]
full_res = sum(full_place)
for ind in range(1, N + 1):
	res = full_res - sum(full_place[ind - 1:ind + 1]) + abs(full_root[ind - 1] - full_root[ind + 1])
	print(res)


N = int(input()) + 2
A = [0]
A.extend(list(map(int, input().split())))
A.append(0)
B = sum((abs(A[i] - A[i - 1]) for i in range(1, N)))
for i in range(1, N - 1):
	print(B - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1]))


n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(1, n):
	total += abs(a[i] - a[i - 1])
total += abs(a[0]) + abs(a[-1])
a.insert(0, 0)
a.append(0)
for i in range(1, n + 1):
	if a[i - 1] <= a[i] and a[i] <= a[i + 1]:
		print(total)
	elif a[i + 1] <= a[i] and a[i] <= a[i - 1]:
		print(total)
	elif max(a[i - 1], a[i + 1]) < a[i]:
		print(total - abs(a[i] - max(a[i - 1], a[i + 1])) * 2)
	elif a[i] < min(a[i - 1], a[i + 1]):
		print(total - abs(a[i] - min(a[i - 1], a[i + 1])) * 2)


N = int(input())
a = list(map(int, input().split()))
A = [0] + a + [0]
total_fee = 0
for i in range(N + 1):
	total_fee += abs(A[i + 1] - A[i])
ans_lst = [total_fee] * N
for j in range(N):
	ans_lst[j] -= abs(A[j + 1] - A[j])
	ans_lst[j] -= abs(A[j + 2] - A[j + 1])
	ans_lst[j] += abs(A[j + 2] - A[j])
	print(ans_lst[j])


n = int(input())
a = [0] + list(map(int, input().split())) + [0]
c = []
total = 0
for i in range(n + 1):
	tmp = abs(a[i + 1] - a[i])
	c.append(tmp)
	total += tmp
for i in range(1, n + 1):
	ans = total - c[i - 1] - c[i] + abs(a[i + 1] - a[i - 1])
	print(ans)


N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
cost = [0] * (N + 2)
for i in range(N + 1):
	cost[i] += abs(A[i + 1] - A[i])
sum_money = sum(cost)
skip = [0] * N
for j in range(N):
	skip[j] += abs(A[j + 2] - A[j])
for k in range(N):
	print(sum_money - (cost[k] + cost[k + 1]) + skip[k])


n = int(input())
As = list(map(int, input().split()))
S = 0
for i in range(n - 1):
	S += abs(As[i] - As[i + 1])
S += abs(As[0]) + abs(As[n - 1])
for i in range(n):
	if i == 0:
		sb1 = abs(As[i])
		sb2 = abs(As[i] - As[i + 1])
		ad = abs(As[i + 1])
	elif i == n - 1:
		sb1 = abs(As[i - 1] - As[i])
		sb2 = abs(As[i])
		ad = abs(As[i - 1])
	else:
		sb1 = abs(As[i - 1] - As[i])
		sb2 = abs(As[i] - As[i + 1])
		ad = abs(As[i - 1] - As[i + 1])
	ans = S - sb1 - sb2 + ad
	print(ans)


n = int(input())
a = [0] + list(map(int, input().split())) + [0]
nums = [0] * (n + 1)
for i in range(n + 1):
	nums[i] = abs(a[i] - a[i + 1])
total = sum(nums)
for i in range(n):
	ans = total - nums[i] - nums[i + 1] + abs(a[i] - a[i + 2])
	print(ans)


import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N = int(input())
A = [0] + list(map(int, input().split())) + [0]
S = 0
for i in range(N + 1):
	S += abs(A[i] - A[i + 1])
for i in range(N):
	print(S - abs(A[i] - A[i + 1]) - abs(A[i + 1] - A[i + 2]) + abs(A[i] - A[i + 2]))


import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
A = np.append(A, 0)
A = np.insert(A, 0, 0)
S = sum(abs(np.diff(A[:])))
for i in range(1, len(A) - 1):
	if A[i - 1] == A[i]:
		print(S)
	elif A[i - 1] < A[i] and A[i] < A[i + 1] or (A[i - 1] > A[i] and A[i] > A[i + 1]):
		print(S)
	else:
		print(S - min(abs(A[i - 1] - A[i]), abs(A[i] - A[i + 1])) * 2)


n = int(input())
A = [0]
a = list(map(int, input().split()))
for a_ in a:
	A.append(a_)
s = 0
A.append(0)
for i in range(n + 1):
	s += abs(A[i + 1] - A[i])
for i in range(1, n + 1):
	print(s + abs(A[i + 1] - A[i - 1]) - (abs(A[i + 1] - A[i]) + abs(A[i] - A[i - 1])))


def main():
	n = int(input())
	a_lst = list(map(int, input().split()))
	a_lst.insert(0, 0)
	a_lst.append(0)
	lst = []
	for i in range(n + 1):
		lst.append(abs(a_lst[i + 1] - a_lst[i]))
	tmp = sum(lst)
	tmp1 = sum(lst)
	answer_lst = []
	for i in range(n):
		for j in range(2):
			tmp1 -= lst[i + j]
		tmp1 += abs(a_lst[i + 2] - a_lst[i])
		answer_lst.append(tmp1)
		tmp1 = tmp
	for i in range(n):
		print(answer_lst[i])

def __starting_point():
	main()
__starting_point()


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from copy import deepcopy

def main():
	(n, *a) = map(int, read().split())
	if n == 2:
		r = [abs(a[1] * 2), abs(a[0] * 2)]
		print(*r, sep='\n')
		return
	amin = min(a)
	a.insert(0, 0)
	a.append(0)
	if amin < 0:
		a2 = [i - amin for i in a]
	else:
		a2 = deepcopy(a)
	cost = 0
	for i1 in range(n + 1):
		cost += abs(a2[i1] - a2[i1 + 1])
	r = [cost] * (n + 2)
	for j in range(1, n + 1):
		if a2[j - 1] <= a2[j] <= a2[j + 1]:
			continue
		elif a2[j - 1] >= a2[j] >= a2[j + 1]:
			continue
		elif a2[j - 1] <= a2[j] and a2[j + 1] <= a2[j]:
			nearer_dis = min(abs(a2[j - 1] - a2[j]), abs(a2[j] - a2[j + 1]))
			r[j] -= nearer_dis * 2
		else:
			nearer_dis = min(abs(a2[j] - a2[j - 1]), abs(a2[j + 1] - a2[j]))
			r[j] -= nearer_dis * 2
	print(*r[1:-1], sep='\n')

def __starting_point():
	main()
__starting_point()


N = int(input())
(*A,) = map(int, input().split())
B = [0] + A + [0]
count = [0] * N
S = abs(B[1] - 0)
i = 1
while i <= N:
	if B[i - 1] <= B[i] <= B[i + 1] or B[i - 1] >= B[i] >= B[i + 1]:
		count[i - 1] = 0
	else:
		count[i - 1] = 2 * min(abs(B[i] - B[i - 1]), abs(B[i + 1] - B[i]))
	S += abs(B[i + 1] - B[i])
	i += 1
for c in count:
	print(S - c)


N = int(input())
A = list(map(int, input().split()))
D1 = []
D2 = []
D1.append(abs(A[0]))
D2.append(abs(A[1]))
for i in range(1, N):
	D1.append(abs(A[i] - A[i - 1]))
D1.append(abs(A[N - 1]))
for i in range(1, N - 1):
	D2.append(abs(A[i + 1] - A[i - 1]))
D2.append(abs(A[N - 2]))
S = sum(D1)
for i in range(N):
	print(S - D1[i] - D1[i + 1] + D2[i])


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
plan = 0
for i in range(N + 1):
	plan += abs(A[i + 1] - A[i])
for i in range(N):
	difference = abs(A[i + 2] - A[i + 1]) + abs(A[i + 1] - A[i]) - abs(A[i + 2] - A[i])
	print(plan - difference)


n = int(input())
a = list(map(int, input().split()))
sm_al = abs(a[0]) + abs(a[n - 1])
for i in range(n - 1):
	sm_al += abs(a[i + 1] - a[i])
sm1 = sm_al - abs(a[1] - a[0]) - abs(a[0]) + abs(a[1])
print(sm1)
for i in range(1, n - 1):
	sm = sm_al - abs(a[i + 1] - a[i]) - abs(a[i] - a[i - 1]) + abs(a[i + 1] - a[i - 1])
	print(sm)
smn = sm_al - abs(a[n - 1] - a[n - 2]) - abs(a[n - 1]) + abs(a[n - 2])
print(smn)


n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
a.append(0)

def cumulative_sum(collection):
	result = [0]
	for i in range(1, len(collection)):
		item = abs(collection[i] - collection[i - 1])
		result.append(result[-1] + item)
	return result
cuma = cumulative_sum(a)
lp = cuma[-1]
for i in range(n):
	gap = abs(cuma[i + 2] - cuma[i]) - abs(a[i + 2] - a[i])
	print(lp - gap, flush=True)


n = int(input())
a = [0] + [int(x) for x in input().split()] + [0]
diff = [abs(a[i] - a[i + 1]) for i in range(n + 1)]
tot = sum(diff)
for i in range(1, n + 1):
	print(tot - diff[i - 1] - diff[i] + abs(a[i - 1] - a[i + 1]))


import sys
import copy
input = sys.stdin.readline
N = int(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)


import sys
import numpy as np
sr = lambda : sys.stdin.readline().rstrip()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
N = ir()
A = np.array([0] + lr() + [0])
diff = np.diff(A)
total = np.abs(diff).sum()
answer = []
for i in range(N):
	answer.append(total - abs(diff[i]) - abs(diff[i + 1]) + abs(A[i + 2] - A[i]))
print('\n'.join(map(str, answer)))


n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
diff = []
for i in range(1, len(a)):
	diff.append(abs(a[i - 1] - a[i]))
ans = sum(diff)
for i in range(1, len(diff)):
	tmp = abs(a[i + 1] - a[i - 1]) - abs(a[i] - a[i + 1]) - abs(a[i - 1] - a[i])
	print(ans + tmp)


def cost(i, j=1):
	return abs(a[i] - a[i + j])
n = int(input())
a = [0] + [int(i) for i in input().split()] + [0]
c = sum([cost(i) for i in range(n + 1)])
for i in range(1, n + 1):
	print(c - cost(i - 1) - cost(i) + cost(i - 1, 2))


n = int(input())
As = list(map(int, input().split()))
ais = [0]
ais.extend(As)
m = 0
ais.append(m)
S = 0
for i in range(n - 1):
	S += abs(As[i] - As[i + 1])
S += abs(As[0]) + abs(As[n - 1])
for i in range(1, n + 1):
	sb1 = abs(ais[i - 1] - ais[i])
	sb2 = abs(ais[i] - ais[i + 1])
	ad = abs(ais[i - 1] - ais[i + 1])
	ans = S - sb1 - sb2 + ad
	print(ans)


n = int(input())
a = list(map(int, input().split())) + [0]
b = [abs(a[0])] + [abs(a[i + 1] - a[i]) for i in range(n)]
c = [abs(a[1])] + [abs(a[i + 2] - a[i]) for i in range(n - 1)]
hon = sum(b)
for i in range(n):
	print(hon - b[i] - b[i + 1] + c[i])


n = int(input())
a = [0] + list(map(int, input().split())) + [0]
b = []
for i in range(n + 1):
	b.append(abs(a[i + 1] - a[i]))
temp = sum(b)
for j in range(n):
	ans = temp - b[j] - b[j + 1] + abs(a[j + 2] - a[j])
	print(ans)


import sys
N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
A.append(0)
sum = 0
for i in range(1, N + 2):
	sum += abs(A[i] - A[i - 1])
for i in range(1, N + 1):
	print(sum + abs(A[i - 1] - A[i + 1]) - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]))


N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
ans = 0
for i in range(1, N + 2):
	ans += abs(A[i] - A[i - 1])
for i in range(1, N + 1):
	Z = ans
	Z -= abs(A[i] - A[i - 1]) + abs(A[i] - A[i + 1]) - abs(A[i + 1] - A[i - 1])
	print(Z)


N = int(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]))


n = int(input())
a = list(map(int, input().split()))
sum1 = 0
for x in range(n - 1):
	sum1 += abs(a[x] - a[x + 1])
sum1 += abs(a[0]) + abs(a[n - 1])
for y in range(n):
	if y == 0:
		print(sum1 - abs(a[0]) - abs(a[1] - a[0]) + abs(a[1]))
	elif y == n - 1:
		print(sum1 - abs(a[n - 1] - a[n - 2]) - abs(a[n - 1]) + abs(a[n - 2]))
	else:
		print(sum1 - abs(a[y] - a[y - 1]) - abs(a[y] - a[y + 1]) + abs(a[y - 1] - a[y + 1]))


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	n = i_input()
	a = i_list()
	total = 0
	now = 0
	for i in a:
		total += abs(now - i)
		now = i
	total += abs(i)
	a.insert(0, 0)
	a.append(0)
	ans = []
	for (i, k) in enumerate(a[1:-1], start=1):
		if a[i - 1] <= k and k <= a[i + 1] or (a[i - 1] >= k and k >= a[i + 1]):
			ans.append(total)
		else:
			ans.append(total - abs(k - a[i - 1]) - abs(k - a[i + 1]) + abs(a[i - 1] - a[i + 1]))
	for i in ans:
		print(i)

def __starting_point():
	main()
__starting_point()


N = int(input())
lsA = [0] + list(map(int, input().split())) + [0]
sum1 = 0
for i in range(1, N + 2):
	sum1 += abs(lsA[i] - lsA[i - 1])
lsans = []
for i in range(1, N + 1):
	if lsA[i - 1] <= lsA[i] and lsA[i] <= lsA[i + 1]:
		lsans.append(sum1)
	elif lsA[i - 1] >= lsA[i] and lsA[i] >= lsA[i + 1]:
		lsans.append(sum1)
	else:
		div = min(abs(lsA[i - 1] - lsA[i]), abs(lsA[i + 1] - lsA[i]))
		lsans.append(sum1 - 2 * div)
for i in lsans:
	print(i)


N = int(input())
A = [0] + [int(X) for X in input().split()] + [0]
Cost = sum((abs(A[T + 1] - A[T]) for T in range(N + 1)))
for T in range(1, N + 1):
	Cut = Cost + abs(A[T + 1] - A[T - 1]) - abs(A[T] - A[T - 1]) - abs(A[T + 1] - A[T])
	print(Cut)


N = int(input())
A = list(map(int, input().split()))
cost = abs(A[0])
for i in range(1, N):
	cost += abs(A[i] - A[i - 1])
cost += abs(A[N - 1])
prev = 0
A.append(0)
for i in range(N):
	x = abs(A[i + 1] - prev)
	y = abs(A[i] - prev) + abs(A[i + 1] - A[i])
	print(cost - (y - x))
	prev = A[i]


n = int(input())
a = [int(i) for i in input().split()]
a.append(0)
a = [0] + a
total = 0
for i in range(1, n + 2):
	total += abs(a[i - 1] - a[i])

def herasu(i):
	ans = total - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])
	return ans
for i in range(1, n + 1):
	print(herasu(i))


N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
sum_all = 0
for (i, a) in enumerate(A[1:N + 2], start=1):
	sum_all += abs(a - A[i - 1])
for (i, a) in enumerate(A[1:N + 1], start=1):
	print(sum_all - abs(a - A[i - 1]) - abs(a - A[i + 1]) + abs(A[i + 1] - A[i - 1]))


n = int(input())
a = [int(t) for t in input().split()]
a.insert(0, 0)
a.append(0)
s = 0
for i in range(1, n + 2):
	s += 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(s)
	else:
		res = s
		res -= abs(a[i - 1] - a[i])
		res -= abs(a[i] - a[i + 1])
		res += abs(a[i - 1] - a[i + 1])
		print(res)


n = int(input())
al = list(map(int, input().split()))
d = [0]
d = d + al
d.append(0)
totald = 0
for i in range(1, n + 2):
	totald += abs(d[i] - d[i - 1])
for i in range(1, n + 1):
	minus = abs(d[i] - d[i - 1]) + abs(d[i + 1] - d[i])
	add = abs(d[i + 1] - d[i - 1])
	print(totald - minus + add)


N = int(input())
A = list(map(int, input().split()))
m = [abs(0 - A[0])] * (N + 1)
for i in range(1, N):
	m[i] = abs(A[i] - A[i - 1])
m[-1] = abs(0 - A[-1])
a = sum(m)
A.append(0)
for i in range(N):
	print(a + abs(A[i - 1] - A[i + 1]) - (abs(A[i - 1] - A[i]) + abs(A[i] - A[i + 1])))


import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
sys.setrecursionlimit(10 ** 6)

def zz():
	return list(map(int, sys.stdin.readline().split()))

def z():
	return int(sys.stdin.readline())

def S():
	return sys.stdin.readline()

def C(line):
	return [sys.stdin.readline() for _ in range(line)]
N = z()
A = zz()
A.append(0)
diff = [0] * N
prev = 0
A_ = [0]
A_.extend(A)
sum_ = 0
for i in range(len(A_) - 1):
	sum_ += abs(A_[i] - A_[i + 1])
for i in range(1, N + 1):
	sub = abs(A_[i] - A_[i - 1]) + abs(A_[i] - A_[i + 1])
	add = abs(A_[i - 1] - A_[i + 1])
	print(sum_ + add - sub)


import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

def solve():
	n = ini()
	a = inl()
	a = [0] + a
	a.append(0)
	total = 0
	for i in range(1, n + 2):
		total += abs(a[i] - a[i - 1])
	for i in range(1, n + 1):
		diff = abs(a[i + 1] - a[i - 1]) - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i])
		print(total + diff)
solve()


N = int(input())
N_List = [0] + list(map(int, input().split())) + [0]
N_Diff_List = []
for i in range(N + 1):
	N_Diff_List.append(abs(N_List[i + 1] - N_List[i]))
sumans = sum(N_Diff_List)
for i in range(N):
	ans = sumans - (N_Diff_List[i] + N_Diff_List[i + 1])
	ans += abs(N_List[i + 2] - N_List[i])
	print(ans)


n = int(input())
a = list(map(int, input().split()))
d = [abs(a[0])]
for i in range(n - 1):
	d.append(abs(a[i + 1] - a[i]))
d.append(abs(a[-1]))
s = sum(d)
for i in range(n):
	if i == 0:
		t = s - d[i] - d[i + 1] + abs(a[i + 1])
	elif i == n - 1:
		t = s - d[i] - d[i + 1] + abs(-a[i - 1])
	else:
		t = s - d[i] - d[i + 1] + abs(a[i + 1] - a[i - 1])
	print(t)


from itertools import accumulate
N = int(input())
A = [0] + list(map(int, input().split())) + [0]
cost = sum((abs(A[i + 1] - A[i]) for i in range(N + 1)))
for i in range(1, N + 1):
	print(cost + abs(A[i + 1] - A[i - 1]) - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]))


n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
d_1 = []
for i in range(1, n + 2):
	d_1.append(abs(a[i] - a[i - 1]))
d_2 = []
for i in range(1, n + 1):
	d_2.append(abs(a[i + 1] - a[i - 1]))
s_d = sum(d_1)
for i in range(1, n + 1):
	print(s_d - d_1[i - 1] - d_1[i] + d_2[i - 1])


def main():
	n = int(input())
	As = [0] + list(map(int, input().split())) + [0]
	cumsum = [0] * (n + 1)
	for i in range(1, n + 2):
		cumsum[i - 1] = abs(As[i] - As[i - 1])
	cumsum_sum = sum(cumsum)
	for i in range(1, n + 1):
		ans = cumsum_sum - cumsum[i - 1] - cumsum[i] + abs(As[i + 1] - As[i - 1])
		print(ans)

def __starting_point():
	main()
__starting_point()