You are given N sightseeing spots on the x-axis, each with a corresponding coordinate. It costs |a - b| yen to travel from point a to point b along the axis. You plan to visit all N spots in order, departing from and returning to the origin. Due to time constraints, you may choose to cancel the visit to a specific spot. For each spot, find the total cost of travel when that spot's visit is canceled. Constraints: 2 ≤ N ≤ 10^5, -5000 ≤ A_i ≤ 5000 (1 ≤ i ≤ N). Input format: N followed by N coordinates. Output format: N lines, each representing the total cost of travel when a specific spot's visit is canceled.

# Buggy version:
n = int(input())
a = [0] + list(map(int,input().split())) + [0]
ans = 0
anslist = [0] * n
for j in range(n + 1):
    if j == 0:
        ans += abs(a[0])
    elif j == n:
        ans += abs(a[n - 1])
    else:
        ans += abs(a[j]-a[j - 1])

for i in range(1, n + 1):
    anslist[i - 1] = ans - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])
            
for k in anslist:
    print(k)


# Fixed version:
n = int(input())
a = [0] + list(map(int,input().split())) + [0]
ans = 0
anslist = [0] * n
for j in range(1, n + 2):
    if j == 1:
        ans += abs(a[j])
    elif j == n + 1:
        ans += abs(a[n])
    else:
        ans += abs(a[j]-a[j - 1])

for i in range(1, n + 1):
    anslist[i - 1] = ans - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])
            
for k in anslist:
    print(k)

# Buggy version:
n=input()
l=[0]+list(map(int,input().split()))+[0]
ans=0
pre=0
for i in l:ans+=abs(pre-i);pre=i
for i in range(1,int(n)+1):
  dif=-abs(l[i]-l[i-1])-abs(l[i]-l[i+1])+abs(l[i-1]-l[i+1])
  if l[i]in(l[i-1],l[i+1]):print(ans)
  elif l[i]<l[i-1]:
    print(ans if l[i+1]<l[i] else ans+dif)
  else:print(ansans if l[i+1]>l[i] else ans+dif)

# Fixed version:
n=input()
l=[0]+list(map(int,input().split()))+[0]
ans=0
pre=0
for i in l:ans+=abs(pre-i);pre=i
for i in range(1,int(n)+1):
  dif=-abs(l[i]-l[i-1])-abs(l[i]-l[i+1])+abs(l[i-1]-l[i+1])
  if l[i]in(l[i-1],l[i+1]):print(ans)
  elif l[i]<l[i-1]:
    print(ans if l[i+1]<l[i] else ans+dif)
  else:print(ans if l[i+1]>l[i] else ans+dif)

# Buggy version:
N = int(input())
A = list(map(int,input().split()))
now = 0
dis = 0
for i in A:
    dis += abs(now-i)
    now = i
ans = dis+abs(now)
B = [0]
B.extend(A)
B.append(0)
print(B)
for i in range(1,N+1):
    if B[i-1] < B[i] > B[i+1] or B[i-1] > B[i] < B[i+1]:
        print(ans - 2*min(abs(B[i-1]-B[i]),abs(B[i]-B[i+1])))
    else:
        print(ans)

# Fixed version:
N = int(input())
A = list(map(int,input().split()))
now = 0
dis = 0
for i in A:
    dis += abs(now-i)
    now = i
ans = dis+abs(now)
B = [0]
B.extend(A)
B.append(0)
for i in range(1,N+1):
    if B[i-1] < B[i] > B[i+1] or B[i-1] > B[i] < B[i+1]:
        print(ans - 2*min(abs(B[i-1]-B[i]),abs(B[i]-B[i+1])))
    else:
        print(ans)

# Buggy version:
from itertools import accumulate
N = int(input())
A = tuple([0,] + list(map(int, input().split())) + [0,])
D = []
sum = 0
for i, a in enumarate(A[1:-1]):
  i += 1
  pre = A[i - 1]
  tem = A[i]
  nex = A[i + 1]
  x = abs(pre - tem) + abs(tem - nex)
  sum += x
  D.append(abs(pre - nex) - x)
for d in D:
  print(sum + d)

# Fixed version:
from itertools import accumulate
N = int(input())
A = tuple([0,] + list(map(int, input().split())) + [0,])
D = []
sum = 0
for i, a in enumerate(A[1:-1]):
  i += 1
  pre = A[i - 1]
  tem = A[i]
  nex = A[i + 1]
  x = abs(pre - tem)
  y = abs(tem - nex)
  sum += x
  D.append(abs(pre - nex) - x - y)
sum += y
for d in D:
  print(sum + d)

# Buggy version:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
        
def main():
    plan=[0]
    n = int(input())
    plan+=list(map(int,input().split()))
    plan.append(0)
    pay_sum = 0
    for i in range(1,n+2):
        pay_sum += abs(plan[i] - plan[i-1])
    
    for i in range(1,n+1):
        result = abs(plan[i-1] - plan[i+1])
        result -= abs(plan[i-1] - plan[i])
        result -= abs(plan[i+1] - plan[i])
        print(pay_sum - result)

if __name__=="__main__":
    main()

# Fixed version:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
        
def main():
    plan=[0]
    n = int(input())
    plan+=list(map(int,input().split()))
    plan.append(0)
    pay_sum = 0
    for i in range(1,n+2):
        pay_sum += abs(plan[i] - plan[i-1])
    
    for i in range(1,n+1):
        result = abs(plan[i-1] - plan[i+1])
        result -= abs(plan[i-1] - plan[i])
        result -= abs(plan[i+1] - plan[i])
        print(pay_sum + result)

if __name__=="__main__":
    main()

# Buggy version:
import sys
input = sys.stdin.readline


def main():
    n = int(input().strip())
    A = [int(i) for i in input().strip().split()]
    A = [0] + A + [0] ## append start and goal (1-indexed table)
    diff = [0] * n # 0-indexed table
    prev = 0
    _sum = 0
    for i in range(1,n):
        _sum += abs(prev - A[i])
        prev = A[i]
        diff[i-1] = abs(A[i-1] - A[i+1]) - (abs(A[i]-A[i-1]) + abs(A[i+1] - A[i]))
    ## add the cost until goal.
    _sum += abs(A[i] - A[i+1])
    
    for i in range(n):
        print(_sum + diff[i])

if __name__ == "__main__":
    main()

# Fixed version:
import sys
input = sys.stdin.readline


def main():
    n = int(input().strip())
    A = [int(i) for i in input().strip().split()]
    A = [0] + A + [0] ## append start and goal (1-indexed table)
    diff = [0] * n # 0-indexed table
    prev = 0
    _sum = 0
    for i in range(1,n+1):
        _sum += abs(prev - A[i])
        prev = A[i]
        diff[i-1] = abs(A[i-1] - A[i+1]) - (abs(A[i]-A[i-1]) + abs(A[i+1] - A[i]))
    ## add the cost until goal.
    _sum += abs(A[n])
    for i in range(n):
        print(_sum + diff[i])

if __name__ == "__main__":
    main()

# Buggy version:
A = list(map(int,input().split()))
A.insert(0,0)
tot = 0
for i in range(1,N+1):
    tot += abs(A[i]-A[i-1])
tot += abs(A[0]-A[N])
for i in range(1,N):
    a = tot-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])
    print(a)
a = tot-abs(A[N]-A[N-1])-abs(0-A[N])+abs(0-A[N-1])
print(a)

# Fixed version:
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
tot = 0
for i in range(1,N+1):
    tot += abs(A[i]-A[i-1])
tot += abs(A[0]-A[N])
for i in range(1,N):
    a = tot-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])
    print(a)
a = tot-abs(A[N]-A[N-1])-abs(0-A[N])+abs(0-A[N-1])
print(a)

# Buggy version:
import itertools

N = int(input())
A = list(map(int,input().split()))

acc = []
prev = 0
for a in A:
  t = abs(a - prev)
  acc.append(t)
  prev = a
  

ans = []
for i in range(N):
  t = 0
  if 0 < i:
    t += acc[i-1]
  
  if i < N-1:
    t += acc[N-1] - acc[i]
    
  ans.append(t)
  
print("\n".join(map(str,ans)))

# Fixed version:
import itertools

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

acc = []
prev = 0
t = 0
for i in range(N+2):
  if i == 0:
    continue
  a = A[i]
  t += abs(a - prev)
  acc.append(t)
  prev = a
  
ans = []
for i in range(N+1):
  if i == 0:
    continue
  t = 0

  if 1 < i:
    t += acc[i-2]
  if i < N:
    t += acc[N] - acc[i]
  t += abs(A[i+1] - A[i-1])
    
  ans.append(t)
  
print("\n".join(map(str,ans)))

# Buggy version:
n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
dis = [0] * (n+1)
for i in range(1, n+2):
    dis[i-1] = abs(a[i] - a[i-1])

S = sum(dis)
print(S)
for i in range(1, n+1):
    A = a[i-1]
    B = a[i]
    C = a[i+1]
    if A > C:
        A, C = C, A
    if A<=B<=C:
        print(S)
    else:
        print(S-2*min(abs(A-B), abs(C-B)))

# Fixed version:
n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
dis = [0] * (n+1)
for i in range(1, n+2):
    dis[i-1] = abs(a[i] - a[i-1])

S = sum(dis)
for i in range(1, n+1):
    A = a[i-1]
    B = a[i]
    C = a[i+1]
    if A > C:
        A, C = C, A
    if A<=B<=C:
        print(S)
    else:
        print(S-2*min(abs(A-B), abs(C-B)))

# Buggy version:
n = int(input())
a = np.array([0] + list(map(int, input().split())) + [0])

whole = np.abs((np.diff(a))).sum()

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

# Fixed version:
import numpy as np
n = int(input())
a = np.array([0] + list(map(int, input().split())) + [0])

whole = np.abs((np.diff(a))).sum()

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

# Buggy version:
import sys
#import numpy as np
import math
from fractions import Fraction
import itertools

input=sys.stdin.readline

n=int(input())
s=list(map(int,input().split()))

d=[0]*(n+1)
d[1]=abs(s[0])
for i in range(2,n+1):
    d[i]=d[i-1]+abs(s[i-1]-s[i-2])
ans=abs(s[n-1])+d[n]-d[2]+d[0]+s[1]
print(ans)
for i in range(1,n-1):
    ans=abs(s[n-1])+d[i]+d[n]-d[i+2]+abs(s[i+1]-s[i-1])
    print(ans)
ans=d[n-1]+abs(s[n-2])
print(ans)

# Fixed version:
import sys
#import numpy as np
import math
from fractions import Fraction
import itertools

input=sys.stdin.readline

n=int(input())
s=list(map(int,input().split()))

d=[0]*(n+1)
d[1]=abs(s[0])
for i in range(2,n+1):
    d[i]=d[i-1]+abs(s[i-1]-s[i-2])
ans=abs(s[n-1])+d[n]-d[2]+d[0]+abs(s[1])
print(ans)
for i in range(1,n-1):
    ans=abs(s[n-1])+d[i]+d[n]-d[i+2]+abs(s[i+1]-s[i-1])
    print(ans)
ans=d[n-1]+abs(s[n-2])
print(ans)

# Buggy version:
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
tot = abs(A[1])
for i in range(2,N+1):
    tot += abs(A[i]-A[i-1])
tot += abs(A[N])
print(tot-abs(A[1])-abs(A[2]-A[1])+abs(A[2]))
for i in range(2,N):
    print(tot-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
print(tot-abs(A[N])-abs(A[N]-A[N-1])+A[N-1])

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

# Buggy version:
def main():
    n=int(input())
    a=list(map(int,input().split()))
    b=[a[0]]
    ans=abs(a[0])
    for i in range(n-1):
        b.append(a[i+1]-a[i])
        ans+=abs(a[i+1]-a[i])
    b.append(-1*a[n-1])
    ans+=abs(a[n-1])
    for i in range(n):
        if b[i]*b[i+1]>=0:
            print(ans)
        else:
            print(ans-b[i]-b[i+1]+abs(b[i]+b[i+1]))
if __name__=="__main__":
    main()

# Fixed version:
def main():
    n=int(input())
    a=list(map(int,input().split()))
    b=[a[0]]
    ans=abs(a[0])
    for i in range(n-1):
        b.append(a[i+1]-a[i])
        ans+=abs(a[i+1]-a[i])
    b.append(-1*a[n-1])
    ans+=abs(a[n-1])
    for i in range(n):
        if b[i]*b[i+1]>=0:
            print(ans)
        else:
            print(ans-abs(b[i])-abs(b[i+1])+abs(b[i]+b[i+1]))
if __name__=="__main__":
    main()

# Buggy version:
N = int(input())
A = [0]
A = A + list(map(int, input().split()))
A.append(0)
print(A)
sumOfRoute = 0
tmp = 0
for a in A:
    sumOfRoute += abs(tmp-a)
    tmp = a

prev = 0
for i in range(1, N+1):
    nexti = A[i+1]
    print(sumOfRoute + abs(prev - nexti) - abs(A[i] - nexti) - abs(prev - A[i]))
    prev = A[i]


# Fixed version:
N = int(input())
A = [0]
A = A + list(map(int, input().split()))
A.append(0)
sumOfRoute = 0
tmp = 0
for a in A:
    sumOfRoute += abs(tmp-a)
    tmp = a

prev = 0
for i in range(1, N+1):
    nexti = A[i+1]
    print(sumOfRoute + abs(prev - nexti) - abs(A[i] - nexti) - abs(prev - A[i]))
    prev = A[i]

# Buggy version:
    N = int(input())
    A = [int(i) for i in input().split()]
    total, plus = A[0], A[1]
    for i in range(N-1):
        total += abs(A[i+1]-A[i])
    total += abs(A[N-1])
    print(total+A[1]-abs(A[1]-A[0])-A[0])
    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]))    
    print(total+A[N-2]-abs(A[N-2]-A[N-1])-abs(A[N-1]))

# Fixed version:
N = int(input())
A = [int(i) for i in input().split()]
total = abs(A[0])
for i in range(N-1):
    total += abs(A[i+1]-A[i])
total += abs(A[N-1])
print(total+abs(A[1])-abs(A[1]-A[0])-abs(A[0]))
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]))    
print(total+abs(A[N-2])-abs(A[N-2]-A[N-1])-abs(A[N-1]))

# Buggy version:
n, *A = map(int, open(0).input().split())
A = [0] + A + [0]
B = [abs(a1-a0) for a0, a1 in zip(A, A[1:])]
s = sum(B)
for i in range(1, n+1):
    print(s + abs(A[i-1]-A[i+1]) - B[i-1] - B[i])

# Fixed version:
n, *A = map(int, open(0).read().split())
A = [0] + A + [0]
B = [abs(a1-a0) for a0, a1 in zip(A, A[1:])]
s = sum(B)
for i in range(1, n+1):
    print(s + abs(A[i-1]-A[i+1]) - B[i-1] - B[i])

# Buggy version:
n = int(input())
a = list(map(int, input().split()))

b = [0] + a + [0]
c = []
for i in range(n+1):
    c.append(abs(b[i] - b[i+1]))

for i in range(n):
    ans = l - c[i] - c[i+1]
    ans += abs(b[i] - b[i+2])
    print(ans)


# Fixed version:
n = int(input())
a = list(map(int, input().split()))

b = [0] + a + [0]
c = []
for i in range(n+1):
    c.append(abs(b[i] - b[i+1]))

l = sum(c)

for i in range(n):
    ans = l - c[i] - c[i+1]
    ans += abs(b[i] - b[i+2])
    print(ans)

# Buggy version:
# ARC093c
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    from collections import Counter

    n = int(input())
    a = [0]
    a.extend(list(map(int, input().split())))
    a.append(0)
    print(a)

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

    for j in range(1, n+1):
        if a[j-1] <= a[j] <= a[j+1] or a[j-1] >= a[j] >= a[j+1]:
            print(total)
            continue
        print(total-abs(a[j]-a[j-1])-abs(a[j+1]-a[j])+abs(a[j+1]-a[j-1]))


if __name__ == '__main__':
    main()


# Fixed version:
# ARC093c
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    from collections import Counter

    n = int(input())
    a = [0]
    a.extend(list(map(int, input().split())))
    a.append(0)
    # print(a)

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

    for j in range(1, n+1):
        if a[j-1] <= a[j] <= a[j+1] or a[j-1] >= a[j] >= a[j+1]:
            print(total)
            continue
        print(total-abs(a[j]-a[j-1])-abs(a[j+1]-a[j])+abs(a[j+1]-a[j-1]))


if __name__ == '__main__':
    main()

# Buggy version:
n = int(input())
a = [0]+list(map(int, input().split()))+[0]

money = [0]
for i in range(n+1):
    money.append(abs(a[i]-a[i+1]))
print(money)
ans = sum(money)
for i in range(n):
    print(ans - sum(money[i+1:i+3]) + abs(a[i]-a[i+2]))

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

# Buggy version:
n = int(input())
a = [ int(x) for x in input().split() ]

ans = a[0] 

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

ans += abs(a[-1] - 0)

for i, v in enumerate(a):
    if i == 0:
        if 0 <= v <= a[i+1] or a[i+1] <= v <= 0:
            print(ans)
        else:
            print(ans-2*abs(v))
    elif i == n-1:
        if a[i-1] <= v <= 0 or 0 <= v <= a[i-1]: 
            print(ans)
        else:
            print(ans-2*abs(v))
    else:
        if a[i-1] <= v <= a[i+1] or a[i+1] <= v <= a[i-1]:
            print(ans)
        elif a[i-1] <= a[i+1] <= v or v <= a[i+1] <= a[i-1]:
            print(ans-abs(a[i+1]-v)*2)
        elif v <= a[i-1] <= a[i+1] or a[i+1] <= a[i-1] <= v:
            print(ans-abs(a[i-1]-v)*2)



# Fixed version:
n = int(input())
a = [ int(x) for x in input().split() ]

ans = abs(a[0] )

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

ans += abs(a[-1] - 0)

for i, v in enumerate(a):
    if i == 0:
        if 0 <= v <= a[i+1] or a[i+1] <= v <= 0:
            print(ans)
        elif 0 <= a[i+1] <= v or v <= a[i+1] <= 0:
            print(ans-abs(a[i+1]-v)*2)
        elif v <= 0 <= a[i+1] or a[i+1] <= 0 <= v:
            print(ans-abs(v)*2)

    elif i == n-1:
        if a[i-1] <= v <= 0 or 0 <= v <= a[i-1]:
            print(ans)
        elif a[i-1] <= 0 <= v or v <= 0 <= a[i-1]:
            print(ans-abs(v)*2)
        elif v <= a[i-1] <= 0 or 0 <= a[i-1] <= v:
            print(ans-abs(a[i-1]-v)*2)

    else:
        if a[i-1] <= v <= a[i+1] or a[i+1] <= v <= a[i-1]:
            print(ans)
        elif a[i-1] <= a[i+1] <= v or v <= a[i+1] <= a[i-1]:
            print(ans-abs(a[i+1]-v)*2)
        elif v <= a[i-1] <= a[i+1] or a[i+1] <= a[i-1] <= v:
            print(ans-abs(a[i-1]-v)*2)

# Buggy version:
n = int(input())
array = [int(x) for x in input().split()]
sum_array = [0 for x in range(n+1)]
now = 0
for i in range(n):
  sum_array[i] = abs(array[i]-now)
  now = array[i]
else:
  sum_array[-1] = abs(now)

for j in range(n):
  if j == 0:
    print(sum_array[-1])
  elif j == n-1:
    print(sum_array[-2]+abs(array[-2]))
  else:
    print(sum_array[-1]-(sum_array[j]-sum_array[j-1])-(sum_array[j+1]-sum_array[j])+(abs(array[j+1]-array[j-1]))

# Fixed version:
n = int(input())
array = [int(x) for x in input().split()]
sum_array = [0]
now = 0
for i in range(n):
    sum_array.append(sum_array[i] + abs(array[i] - now))
    now = array[i]
else:
    sum_array.append(sum_array[-1] + abs(array[-1] - 0))

for j in range(n):
    if j == 0:
        print(sum_array[-1] -
              (sum_array[j + 1] - sum_array[j]) -
              (sum_array[j + 2] - sum_array[j + 1]) +
              (abs(array[j + 1] - 0))
              )
    elif j == n - 1:
        print(sum_array[-3] + abs(array[-2]))
    else:
        print(sum_array[-1] -
              (sum_array[j + 1] - sum_array[j]) -
              (sum_array[j + 2] - sum_array[j + 1]) +
              (abs(array[j + 1] - array[j - 1]))
              )

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

# Fixed version:
N = int(input())
A = list(map(int, input().split()))

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

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

# Buggy version:
N = int(input())
A = [0] + list(map(int,input().split())) + [0]
print(A)

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

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

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

# Fixed version:
N = int(input())
A = [0] + list(map(int,input().split())) + [0]

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

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

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

# Buggy version:
n = int(input())
a = list(map(int,input().split()))
al = [0] * n
for i in range(n):
  al[i] = abs(a[i+1] - a[i])
s = sum(al)
for i in range(n):
  print(s-al[i-1]-al[i]+abs(a[i+1]-a[i-1]))

# Fixed version:
n = int(input())
ai = list(map(int,input().split()))
a = [0]
for i in ai:
  a.append(i)
al = [0] * (n+1)
for i in range(n+1):
  al[i] = abs(a[(i+1)%(n+1)] - a[i])
s = sum(al)
for i in range(1,n+1):
  print(s-al[i-1]-al[i]+abs(a[(i+1)%(n+1)]-a[i-1]))

# Buggy version:
def main():
    N = int(input())
    A = [0] + list(map(int, input().split())) + [0]

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

    for i in range(1, N+1):
        if (A[i-1] <= A[i] <= A[i+1]): print(sum)
        elif (A[i-1] >= A[i] >= A[i+1]): print(sum)
        else: print(sum - abs(A[i] - A[i-1]) * 2)

if __name__ == '__main__':
    main()


# Fixed version:
def main():
    N = int(input())
    A = [0] + list(map(int, input().split())) + [0]

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

    for i in range(1, N+1):
        if A[i-1] <= A[i] <= A[i+1]: print(sum)
        elif A[i-1] >= A[i] >= A[i+1]: print(sum)
        elif A[i-1] < A[i+1] < A[i] or A[i-1] > A[i+1] > A[i]: print(sum - abs(A[i+1] - A[i]) * 2)
        else: print(sum - abs(A[i] - A[i-1]) * 2)


if __name__ == '__main__':
    main()

# Buggy version:
N = int(input())
A = list(map(int, input().split()))
s = abs(A[0]) + abs(A[-1])
for i in range(N-1):
  s += abs(A[i+1] - A[i])
#print(s)
for i in range(N):
  b = A[i]
  if i == 0:
    a = 0
  else:
    a = A[i-1]
  if i == N-1:
    c = 0
  else:
    c = A[i+1]
  if a < b and b < c:
    print(s)
  elif a < c and c < b:
    print(s-(b-c)*2)
  elif b < a and a < c:
    print(s-(c-a)*2)
  elif b < c and c < a:
    print(s-(c-b)*2)
  elif c < a and a < b:
    print(s-(b-a)*2)
  else:
    print(s)


# Fixed version:
N = int(input())
A = list(map(int, input().split()))
s = abs(A[0]) + abs(A[-1])
for i in range(N-1):
  s += abs(A[i+1] - A[i])
#print(s)
for i in range(N):
  b = A[i]
  if i == 0:
    a = 0
  else:
    a = A[i-1]
  if i == N-1:
    c = 0
  else:
    c = A[i+1]
  if a <= b and b <= c:
    print(s)
  elif a <= c and c <= b:
    print(s-(b-c)*2)
  elif b <= a and a <= c:
    print(s-(a-b)*2)
  elif b <= c and c <= a:
    print(s-(c-b)*2)
  elif c <= a and a <= b:
    print(s-(b-a)*2)
  else:
    print(s)

# Buggy version:
n = int(input
A = [0] + list(map(int, input().split())) + [0]

#普通に総和を出す
sum = 0
for i, a in enumerate(A):
  if i == n+1: break #n+1はゴールなので先に行かない
  sum += abs(a - A[i+1]) #a:A[i]
  
#引いて足す
for i in range(1, n+1, 1): #1～Nを省いたとき
  nowsum = sum
  nowsum -= abs(A[i-1]-A[i])
  nowsum -= abs(A[i]-A[i+1])
  nowsum += abs(A[i-1]-A[i+1])
  print(nowsum)


# Fixed version:
n = int(input())
tmpa = list(map(int, input().split()))
A = [0] * (n+2)
A[0] = 0
A[n+1] = 0
for i in range(1,n+1,1): A[i] = tmpa[i-1]


#普通に総和を出す
sum = 0
for i, a in enumerate(A):
  if i == n+1: break #n+1はゴールなので先に行かない
  sum += abs(a - A[i+1]) #a:A[i]
  
#引いて足す
for i in range(1, n+1, 1): #1～Nを省いたとき
  nowsum = sum
  nowsum -= abs(A[i-1]-A[i])
  nowsum -= abs(A[i]-A[i+1])
  nowsum += abs(A[i-1]-A[i+1])
  print(nowsum)

# Buggy version:
N = int(input())
A = [0] * (N + 2)
for i, v in enumerate(input().split()):
    A[i+1] = int(v)
num = sum([abs(A[i] - A[i+1]) for i in range(N+1)])
for i in range(N):
    ret = num + abs(A[i-1] - A[i+1]) - (abs(A[i-1] - A[i]) + abs(A[i] - A[i+1]))
    print(ret)

# Fixed version:
N = int(input())
A = [0] * (N + 2)
for i, v in enumerate(input().split()):
    A[i+1] = int(v)
num = sum([abs(A[i] - A[i+1]) for i in range(N+1)])
for i in range(1,N+1):
    ret = num + abs(A[i-1] - A[i+1]) - (abs(A[i-1] - A[i]) + abs(A[i] - A[i+1]))
    print(ret)

# Buggy version:
A=int(input())
B=list(map(int,input().split()))
a=0
S=0
for i in range(len(B)):
    S+=abs(B[i]-a)
    a=B[i]
S+=abs(B[-1])
for j in range(len(B)):
    if j=0:
        if 0<=B[0]<=B[1] or 0>=B[0]>=B[1]:
            print(S)
        elif B[0]<=0<=B[1] or B[0]>=0>=B[1]:
            print(S-abs(B[0]))
        else:
            print(S-abs(B[1]-B[0]))
    elif j=len(B)-1:
        if 0<=B[-1]<=B[-2] or 0>=B[-1]>=B[-2]:
            print(S)
        elif B[-1]<=0<=B[-2] or B[-1]>=0>=B[-2]:
            print(S-abs(B[-1]))
        else:
            print(S-abs(B[-1]-B[-2]))
    else:
        if B[j-1]<=B[j]<=B[j+1] or B[j-1]>=B[j]>=B[j+1]:
            print(S)
        elif B[j]<=B[j-1]<=B[j+1] or B[j]>=B[j-1]>=B[j+1]:
            print(S-abs(B[j-1]-B[j]))
        else:
            print(S-abs(B[j+1]-B[j]))

# Fixed version:
A=int(input())
B=list(map(int,input().split()))
a=0
S=0
for i in range(len(B)):
    S+=abs(B[i]-a)
    a=B[i]
S+=abs(B[-1])
for j in range(len(B)):
    if j==0:
        if 0<=B[0]<=B[1] or 0>=B[0]>=B[1]:
            print(S)
        elif B[0]<=0<=B[1] or B[0]>=0>=B[1]:
            print(S-2*abs(B[0]))
        else:
            print(S-2*abs(B[1]-B[0]))
    elif j==len(B)-1:
        if 0<=B[-1]<=B[-2] or 0>=B[-1]>=B[-2]:
            print(S)
        elif B[-1]<=0<=B[-2] or B[-1]>=0>=B[-2]:
            print(S-2*abs(B[-1]))
        else:
            print(S-2*abs(B[-1]-B[-2]))
    else:
        if B[j-1]<=B[j]<=B[j+1] or B[j-1]>=B[j]>=B[j+1]:
            print(S)
        elif B[j]<=B[j-1]<=B[j+1] or B[j]>=B[j-1]>=B[j+1]:
            print(S-2*abs(B[j-1]-B[j]))
        else:
            print(S-2*abs(B[j+1]-B[j]))

# Buggy version:
N = int(input())
A = [int(x) for x in input().split()]


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

for i in range(1, N + 1):
    d1 = abs(A[i - 1] - A[i])
    d2 = abs(A[i + 1] - A[i])
    d3 = abs(A[i - 1] - A[i + 1])
    print(sum - d1 - d2 + d3)

# Fixed version:
N = int(input())
A = [int(x) for x in input().split()]


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

for i in range(1, N + 1):
    d1 = abs(A[i - 1] - A[i])
    d2 = abs(A[i + 1] - A[i])
    d3 = abs(A[i - 1] - A[i + 1])
    print(sum - d1 - d2 + d3)

# Buggy version:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(sys.stdin.readline())

A = map(lambda x: int(x), sys.stdin.readline().split(' '))

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

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

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


# Fixed version:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(sys.stdin.readline())

A = sys.stdin.readline().split(' ')

A = [int(x) for x in A]

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

total = 0

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

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

# Buggy version:
n = int(input())
a = list(map(int, input().split()))

s = abs(a[0]) + abs(a[-1])
l = [abs(a[0])]
a.append(0)
for i in range(n-1):
    if a[i] >= 0 and a[i+1] >= 0 or a[i] < 0 and a[i+1] < 0:
        l.append(max(abs(a[i]), abs(a[i+1])) - min(abs(a[i]), abs(a[i+1])))
        s += l[i+1]
    else:
        l.append(abs(a[i]) + abs(a[i+1]))
        s += l[i+1]
l.append(abs(a[-2]))

a = [0]+a
for i in range(1, n+1):
    if 0 <= a[i] <= a[i+1] or 0 > a[i] > a[i+1]:
        print(s)
    elif a[i] <= a[i-1] <= a[i+1] or a[i+1] <= a[i-1] <= a[i]:
        print(s-l[i-1]*2)
    else:
        print(s-l[i]*2,2)

# Fixed version:
n = int(input())
l = [0] + list(map(int,input().split())) + [0]

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

for i in range(1,n+1):
  if (l[i-1] <= l[i] and l[i] <= l[i+1]) or (l[i-1] >= l[i] and l[i] >= l[i+1]):
    print(s)
  elif l[i-1] < l[i] and l[i] > l[i+1]:
    print(s - 2*abs(l[i] - max(l[i-1],l[i+1])))
  else:
    print(s - 2*abs(l[i] - min(l[i-1],l[i+1])))

# Buggy version:
n = int(input())
a = list(map(int,input().split()))
a = [0] + a + [0]

s = 0

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

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

# Fixed version:
n = int(input())
a= [0] + list(map(int, input().split())) + [0]

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

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