CodeEff/ECCO huggingface dataset:
# Original solution
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W, N = list(map(int, input().split()))
sr, sc = list(map(int, input().split()))
stS = [v for v in input()[:-1]]
stT = [v for v in input()[:-1]]

ans = "YES"
# T=U,A=D
T = "U"
A = "D"
m = sr
# print("U")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m -= 1
        if m <= 0:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m < H:
            m += 1

T = "D"
A = "U"
m = sr
# print("D")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m += 1
        if m > H:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m > 1:
            m -= 1

T = "R"
A = "L"
m = sc
# print("R")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m += 1
        if m > W:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m > 1:
            m -= 1
T = "L"
A = "R"
m = sc
# print("L")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m -= 1
        if m <= 0:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m < H:
            m += 1
print(ans)


# Optimized solution
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H,W,N=list(map(int,input().split()))

sr,sc=list(map(int,input().split()))
S=input()[:-1]
T=input()[:-1]

left=0
right=W+1
up=0
down=H+1

ans="YES"
for i,(s,t) in enumerate(zip(reversed(S),reversed(T))):
    if i!=0:
        if t=='R':
            left=max(0,left-1)
        elif t=="L":
            right=min(W+1,right+1)
        elif t=="D":
            up = max(0,up-1)
        else:
            down=min(H+1,down+1)


    if s=="R":
        right-=1
    elif s=="L":
        left+=1
    elif s=="D":
        down-=1
    else:
        up+=1

    if right-left==1 or down-up==1:
        ans="NO"
        break

if not left<sc<right or not up<sr<down:
    ans="NO"
print(ans)
# Original solution
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H,W,N=list(map(int,input().split()))

sr,sc=list(map(int,input().split()))
S=input()[:-1]
T=input()[:-1]

left=0
right=W+1
up=0
down=H+1

ans="YES"
for i,(s,t) in enumerate(zip(reversed(S),reversed(T))):
    if i!=0:
        if t=='R':
            left=max(0,left-1)
        elif t=="L":
            right=min(W+1,right+1)
        elif t=="D":
            up = max(0,up-1)
        else:
            down=min(H+1,down+1)


    if s=="R":
        right-=1
    elif s=="L":
        left+=1
    elif s=="D":
        down-=1
    else:
        up+=1

    if right-left==1 or down-up==1:
        ans="NO"
        break

if not left<sc<right or not up<sr<down:
    ans="NO"
print(ans)


# Optimized solution
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H,W,N=list(map(int,input().split()))

sr,sc=list(map(int,input().split()))
S=input()[:-1]
T=input()[:-1]

left=0
right=W+1
up=0
down=H+1

ans="YES"
for i,(s,t) in enumerate(zip(reversed(S),reversed(T))):
    if i!=0 or True:
        if t=='R':
            left=max(0,left-1)
        elif t=="L":
            right=min(W+1,right+1)
        elif t=="D":
            up = max(0,up-1)
        else:
            down=min(H+1,down+1)


    if s=="R":
        right-=1
    elif s=="L":
        left+=1
    elif s=="D":
        down-=1
    else:
        up+=1

    if right-left==1 or down-up==1:
        ans="NO"
        break

if not left<sc<right or not up<sr<down:
    ans="NO"
print(ans)
# Original solution
h, w, n = list(map(int, input().split()))
y, x = list(map(int, input().split()))
s = input().rstrip()
t = input().rstrip()


def check(direction, opposite_direction, pos, target):
    for i in range(n):
        if s[i] == direction:
            pos += 1
        if pos == target:
            return False
        if t[i] == opposite_direction and pos > 1:
            pos -= 1
    return True


for d, od, pos, target in [
    ('R', 'L', x, w + 1),
    ('L', 'R', w + 1 - x, w + 1),
    ('D', 'U', y, h + 1),
    ('U', 'D', h + 1 - y, h + 1),
]:
    ok = check(d, od, pos, target)
    if not ok:
        print('NO')
        break
else:
    print('YES')

# Optimized solution
h, w, n = list(map(int, input().split()))
y, x = list(map(int, input().split()))
s = input().rstrip()
t = input().rstrip()


def check(pos_dir, neg_dir, minlim, maxlim, start):
    lim = maxlim
    count = 0
    for sc, tc in zip(s[::-1], t[::-1]):
        if tc == pos_dir:
            minlim = max(minlim - 1, 0)
        elif tc == neg_dir:
            maxlim = min(maxlim + 1, lim)
        if sc == pos_dir:
            maxlim -= 1
        elif sc == neg_dir:
            minlim += 1
        count += 1
        if minlim > maxlim:
            return False
    return minlim <= start <= maxlim


for elem in [
    ('R', 'L', 0, w - 1, x - 1),
    ('D', 'U', 0, h - 1, y - 1),
]:
    if not check(*elem):
        print('NO')
        break
else:
    print('YES')
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・N=6とする。
・[1,1,1,1,1,1],[0,1,1,1,1,1],[0,0,1,1,1,1],[0,0,0,1,1,1],[0,0,0,0,1,1],[0,0,0,0,0,1],[0,0,0,0,0,0]
合計ちょうど6個の線形結合 → 任意の単調数列。最初のやつは1回以上使わなければいけない。
・1,0,-1,-2,-2,-1,0 合計5個で0以上を作る
・-1,0,1,2,2,1,0 合計5個で0以下を作る
・0,1,2,3,3,2,1 合計5個で5以下を作る
・1,2,3,3,2,1 任意個数で5以下を作る
"""

N,MOD = list(map(int,read().split()))

if N % 2 == 0:
    A = list(range(1,N//2+1))*2
else:
    A = list(range(1,N//2+1))*2+[(N+1)//2]

A.sort()

# 和 -> 通り
dp = [1] + [0] * (N+N+10)
for x in A:
    for i in range(N+1):
        dp[i] %= MOD
        dp[i+x] += dp[i]

answer = sum(dp[:N]) % MOD
print(answer)

# Optimized solution
N,M=list(map(int,input().split()))
A = list(range(1,N//2+1))*2
if N&1:A+=[(N+1)//2]
d=[1]+[0]*(N+N)
for x in A:
  for i in range(N+1):
    d[i]%=M
    d[i+x]+=d[i]
print((sum(d[:N])%M))
# Original solution
import copy
N=int(eval(input()))
A=list(map(int,input().split()))


for i in range(N):
    tujyo=0
    S=0

    for k in range(N):
        if i!=k:
            
            tujyo+=abs(A[k]-S)
            S=A[k]
          
    tujyo+=abs(0-S)
    print(tujyo)

# Optimized solution

N=int(eval(input()))

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

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


for k in range(1,N+1):
    mae=A[k-1]
    usiro=A[k+1]
    if mae<= A[k]<=usiro or usiro<= A[k]<=mae:
        print(tujyo)
    else:
        print((tujyo-abs(A[k]-mae)-abs(usiro-A[k])+abs(usiro-mae)))
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
A.append(0)
for i in range(0, N):
    cost = 0
    pos = 0
    for p in range(0, N+1):
        if p != i:
            cost += abs(pos - A[p])
            pos = A[p]
    print(cost)


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

cost = 0
pos = 0
for p in range(0, len(A)):
    cost += abs(pos - A[p])
    pos = A[p]

for i in range(1, len(A)-1):
    n_cost = 0
    if A[i-1] <= A[i] and A[i] <= A[i + 1]:
        n_cost = cost
    elif A[i] <= A[i - 1] and A[i] <= A[i + 1]:
        n_cost = cost - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1])
    elif A[i] >= A[i - 1] and A[i] >= A[i + 1]:
        n_cost = cost - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1])
    elif A[i-1] >= A[i] and A[i] >= A[i + 1]:
        n_cost = cost

    print(n_cost)
# Original solution
N = int(eval(input()))
L = [0] + list(map(int, input().split())) + [0]
edge = []
distance = 0
for i in range(N+1):
    distance += abs(L[i] - L[i+1])
for i in range(1,N+1):
    if (L[i] -L[i-1])*(L[i+1] - L[i] )>=0:
        pass
    else:
        edge.append(i)
for i in range(1,N+1):
    if i in edge:
        print((distance-2*min(abs(L[i]-L[i+1]),abs(L[i]-L[i-1]))))
    else:
        print(distance)

# Optimized solution
N = int(eval(input()))
L =[0]+ list(map(int,input().split()))+[0]
dis = 0
for i in range(N+1):
    dis += abs(L[i] - L[i+1])
#print(L,dis)
for i in range(1,N+1):
    print((dis + abs(L[i-1]-L[i+1]) - abs(L[i-1]-L[i]) - abs(L[i]-L[i+1])))
# Original solution
n = int(eval(input()))
a = [0]+list(map(int,input().split()))+[0]
for i in range(1,n+1):
    ans = 0
    b = a[:i]+a[i+1:]
    for j in range(len(b)-1):
        ans += abs(b[j]-b[j+1])
    print(ans)

# Optimized solution
n = int(eval(input()))
a = [0]+list(map(int,input().split()))+[0]
cost = sum([abs(a[i-1]-a[i]) for i in range(1,n+2)])
for i in range(1,n+1):
    print((cost-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()))
A=list(map(int,input().split()))
A_dis=[abs(A[0]-0)]+list(abs(A[i+1]-A[i]) for i in range(N-1))+[abs(0-A[N-1])]
for j in range(N):
    if j!=0 and j!=N-1:
        print((sum(A_dis)-abs(A[j]-A[j-1])-abs(A[j+1]-A[j])+abs(A[j+1]-A[j-1])))
    elif j==0:
        print((sum(A_dis) - abs(A[j]) - abs(A[j + 1] - A[j])+abs(A[j+1])))
    else:
        print((sum(A_dis) - abs(A[j]) - abs(A[j - 1] - A[j]) + abs(A[j - 1])))

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
A_dis=[abs(A[0]-0)]+list(abs(A[i+1]-A[i]) for i in range(N-1))+[abs(0-A[N-1])]
total=sum(A_dis)
for j in range(N):
    if j!=0 and j!=N-1:
        print((total-abs(A[j]-A[j-1])-abs(A[j+1]-A[j])+abs(A[j+1]-A[j-1])))
    elif j==0:
        print((total- abs(A[j]) - abs(A[j + 1] - A[j])+abs(A[j+1])))
    else:
        print((total- abs(A[j]) - abs(A[j - 1] - A[j]) + abs(A[j - 1])))
# Original solution
n = int(eval(input()))
a_lst = list(map(int, input().split()))

for i in range(n):
  d = 0
  lst = a_lst[:i] + a_lst[i+1:]
  for i, elem in enumerate(lst):
    if i == 0:
      d += abs(elem)
    else:
      d += abs(elem - lst[i-1])
  d += abs(lst[-1])
  print(d)

# Optimized solution
n = int(eval(input()))
a = [0]
a += list(map(int, input().split()))
a.append(0)
d = []
for i in range(n + 1):
  d.append(abs(a[i] - a[i + 1]))
s = sum(d)
for i in range(n):
  print((s - d[i] - d[i + 1] + abs(a[i] - a[i + 2])))
# Original solution
N=int(eval(input()))
s=list(map(int,input().split()))
for i in range(N):
    t,ans=[],0
    t+=s
    t.pop(i)
    t.insert(0,0)
    t.append(0)
    for k in range(N):
        ans+=abs(t[k]-t[k+1])
    print(ans)    
        

# Optimized solution
N=int(eval(input()))
s=list(map(int,input().split()))
s.insert(0,0)
s.append(0)
ans=0
for k in range(N+1):
    ans+=abs(s[k]-s[k+1])
for i in range(N):
    a,b,c=s[i]-s[i+1],s[i+1]-s[i+2],s[i]-s[i+2]
    if a*b>=0:
        print(ans)
    else:
        print((ans-abs(a)-abs(b)+abs(c)))
# Original solution
N = int(eval(input()))
A_list = list(map(int,input().split()))

for i in range(N):
    li = []
    for l in range(N):
        li.append(A_list[l])
    del li[i]
    ans = abs(li[0]) + abs(li[N-2])
    for m in range(N-2):
        ans += abs(li[m] - li[m+1])
    print(ans)


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

for i in range(1,N+1):
    print((S - abs(point_list[i-1] - point_list[i])
    -abs(point_list[i] - point_list[i+1])
    +abs(point_list[i-1] - point_list[i+1])))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(N):
    cost = 0
    pos = 0
    for j in range(N):
        if(i == j):
            continue
        cost += abs(A[j] - pos)
        pos = A[j]
    cost += abs(pos)
    print(cost)

# Optimized solution
N = int(eval(input()))
A = [0]
B = list(map(int, input().split()))
for i in range(len(B)):
    A.append(B[i])
A.append(0)
S = []
cost = 0
pos = 0
for i in range(1, N + 1):
    cost += abs(A[i] - pos)
    pos = A[i]
    S.append(cost)
S.append(cost + abs(pos))

for i in range(N):
    print((S[-1] + abs(A[i] - A[i + 2]) - (abs(A[i] - A[i + 1]) + abs(A[i + 1] - A[i + 2]))))
# Original solution
# -*- coding: utf-8 -*-

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

for i in range(n):
    ans = 0
    p = 0
    end = 0
    for j in range(n):
        if j != i :
            ans = ans + abs(spot[j] - p)
            p = spot[j]
    ans = ans + abs(p - end)
    print(ans)

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

n = int(input())
spot = [0] + list(map(int, input().split())) + [0]

all_sum = 0
for j in range(n+1):
    all_sum = all_sum + abs(spot[j+1] - spot[j])

for i in range(n):
    ans = all_sum - abs(spot[i+1] - spot[i]) - abs(spot[i+2] - spot[i+1]) + abs(spot[i+2] - spot[i])
    print(ans)
# Original solution
#ABC092C
#Input
N=int(eval(input()))
A=list(map(int, input().split()))
#Prepare
Now=0
Next=0
ans=0
#Processing
for i in range(N):
    ans=0
    Now=0
    for j in range(N):
        if j!=i:
            Next=A[j]
            ans+=abs(Next-Now)
            Now=Next
    ans+=abs(0-Now)
    print(ans)

# Optimized solution
#ABC092C
N=int(eval(input()))
A=list(map(int, input().split()))
base=0
Now=0
Next=0
for i in range(N):
    Now=Next
    Next=A[i]
    base+=abs(Next-Now)
base+=abs(A[N-1]-0)
for i in range(N):
    if i==0:
        ans = base - abs(A[i] - 0) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - 0)
    elif i==N-1:
        ans = base - abs(A[i] - A[i - 1]) - abs(0 - A[i]) + abs(0 - A[i - 1])
    else:
        ans = base - 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 = [0] + list(map(int,input().split())) + [0]
B = [0]*n
C = [0]*(n+1)

for i in range(n):
    B[i]=abs(A[i]-A[i+2])
for i in range(n+1):
    C[i]=abs(A[i]-A[i+1])
for i in range(n):
    print((sum(C[0:i])+B[i]+sum(C[i+2:n+1])))

# Optimized solution
n = int(eval(input()))
A = [0] + list(map(int,input().split())) + [0]
B = [0]*n
C = [0]*(n+1)

for i in range(n):
    B[i]=abs(A[i]-A[i+2])
for i in range(n+1):
    C[i]=abs(A[i]-A[i+1])
sumC = sum(C)
for i in range(n):
    print((sumC+B[i]-C[i]-C[i+1]))
# Original solution
if __name__ == '__main__':
    N = int(eval(input()))
    P = list(map(int,input().split()))
    P.insert(0, 0)
    Dis = [[abs(P[i]-P[(i+j+1)%(N+1)]) for i in range(N+1)] for j in range(2)]
    
    for i in range(N): print((sum(Dis[0])-sum(Dis[0][i:i+2])+Dis[1][i]))

# Optimized solution
if __name__ == '__main__':
    N = int(eval(input()))
    P = list(map(int,input().split()))
    P.insert(0, 0)
    Dis = [[abs(P[i]-P[(i+j+1)%(N+1)]) for i in range(N+1)] for j in range(2)]
    temp = sum(Dis[0])
    temp2 = [sum(Dis[0][i:i+2]) for i in range(N)]
    for i in range(N): print((temp-temp2[i]+Dis[1][i]))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
b=[]
for i in range(N):
    b=[]
    count=0
    b.append(0)
    for j in range(N):
        if i!=j:
            b.append(A[j])
    b.append(0)
    for k in range(N):
        count+=abs(b[k+1]-b[k])
        #print(count)
    print(count)

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
cost=[0]*(N+1)
cost[0]=abs(A[0]-0)#0からA[0]の距離
for i in range(1,N):#from 1 to N
    cost[i]=abs(A[i]-A[i-1])+cost[i-1]#累積和
    #cost[1]=abs(A[1]-A[0])+cost[0] 今までの距離+現在の距離
#cost[0:N]
cost[N]=abs(A[N-1])+cost[N-1]#今までの距離+現在の距離(0から最後のところまでの距離)

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

# Optimized solution
n = int(eval(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]))
# Original solution
# coding: utf-8
N=int(eval(input()))
A=list((list(map(int,input().split()))))
A.insert(0,0)

d=[]
skip_d=[]

for i in range(N):
    d.append(abs(A[i+1]-A[i]))
    if i<N-1:
        skip_d.append(abs(A[i+2]-A[i]))
    else:
        skip_d.append(abs(A[0]-A[i]))

d.append(abs(A[-1]))


for i in range(N):
    ans=sum(d)-(d[i]+d[i+1])+skip_d[i]
    
    print(ans)

# Optimized solution
# coding: utf-8
N=int(eval(input()))
A=list((list(map(int,input().split()))))
A.insert(0,0)

d=[]
skip_d=[]

for i in range(N):
    d.append(abs(A[i+1]-A[i]))
    if i<N-1:
        skip_d.append(abs(A[i+2]-A[i]))
    else:
        skip_d.append(abs(A[0]-A[i]))

d.append(abs(A[-1]))

sum_d=sum(d)

for i in range(N):
    ans=sum_d-(d[i]+d[i+1])+skip_d[i]
    
    print(ans)
# Original solution
# -*- coding: utf-8 -*-
"""
Created on Wed Aug  8 14:35:24 2018

@author: sugawara
"""

def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    #N = 6
    #A = [-679, -2409, -3258, 3095, -3291, -4462]
    # iからi+1への移動距離
    delta_A = [abs(A[0])] + [abs(A[i] - A[i-1]) for i in range(1, N)]
    
    #i番目を抜かしたときの
    delta_A_1skip = [abs(A[1])] + [abs(A[i+1] - A[i-1]) for i in range(1, N-1)] + [abs(A[N-2])]
    
    res = []
    for i in range(N):
        # i番目を抜いた場合を考える
        tmp_delta_A = delta_A[:i] + [delta_A_1skip[i]] + delta_A[i+2:]
        if i != N-1:
            tmp_delta_A.append(abs(A[-1]))
        res.append(sum(tmp_delta_A))
    #    break
        
    for i in range(N):
        print((res[i]))
if __name__=='__main__':
    main()

# Optimized solution
# -*- coding: utf-8 -*-
"""
Created on Wed Aug  8 14:35:24 2018

@author: sugawara
"""


N = int(eval(input()))
A = [int(i) for i in input().split()]
#N = 6
#A = [-679, -2409, -3258, 3095, -3291, -4462]
#N = 3
#A = [3, 5, -1]

# iからi+1への移動距離
delta_A = [abs(A[0])] + [abs(A[i] - A[i-1]) for i in range(1, N)] + [abs(A[-1])]
sum_of_all = sum(delta_A)

A = [0] + A + [0]
res = []
for i in range(N):
    res.append(sum_of_all - abs(A[i+1] - A[i]) - abs(A[i+2] - A[i+1]) + abs(A[i+2] - A[i]))
    
    
for i in range(N):
    print((res[i]))
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))
for i in range(n):
    ans = 0
    now = 0
    for j, a in enumerate(A):
        if i == j:
            continue
        ans += abs(a-now)
        now = a
    print((ans + abs(now)))

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

for i in range(N):
    l = list(A)
    l.pop(i)
    answer = 0
    for j in range(len(l)-1):
        answer += abs(l[j]-l[j+1])
    else:
        answer += abs(l[0])+abs(l[-1])
    print(answer)
    


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

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

# Optimized solution
N=int(eval(input()))
a=[0]+list(map(int,input().split()))+[0]
cost=[]
for i in range(N+1):
    cost.append(abs(a[i+1]-a[i]))
S = sum(cost)
for i in range(N):
    print((S-cost[i]-cost[i+1]+abs(a[i+2]-a[i])))
# Original solution
n = int(eval(input()))
travel = list(map(int,input().split()))
plan = travel.copy()
start = 0
answer = 0
answer_list = list()

for i in range(n):
    plan.pop(i)
    for j in range(len(plan)):
        answer += abs(plan[j]-start)
        start = plan[j]
    answer += abs(plan[len(plan)-1])
    answer_list.append(answer)
    answer = 0
    start = 0
    plan = travel.copy()
    
for i in range(len(answer_list)):
    print((answer_list[i]))

# 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(1,n+2):
    total+=abs(a[i]-a[i-1])
for i in range(1,n+1):
    ans=total-(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()))

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

d.append(-a[-1])

for i in range(n):
    s = 0
    for j in range(n+1):
        if j == i:
            s += abs(d[j] + d[j+1])
        elif j == i + 1:
            pass
        else:
            s += abs(d[j])
    print(s)

# Optimized solution
n = int(eval(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)
# Original solution
import copy
n = int(eval(input()))
a = list(map(int, input().split()))

for i in range(n):
	cnt = 0
	c = []
	c = copy.copy(a)
	c.pop(i)
	iti = 0
	for j in range(len(c)):
		cnt += abs(c[j] - iti)
		iti = c[j]
	cnt += abs(c[-1])
	print (cnt)


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

for i in range(n):
	print((cnt + abs(a[i] - a[i+2]) - abs(a[i] -a[i+1]) - abs(a[i+1] - a[i+2])))
# Original solution
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = list(map(int, input().split()))
L = [int(v) for v in input().split()]
# L = [int(input()) for _ in range(Q)]
# S = input().strip()

su = abs(L[0])
a = [0] * N
for i in range(1, N):
    t = 0
    if L[i - 1] * L[i] < 0:
        t = abs(L[i - 1]) + abs(L[i])
    else:
        t = abs(L[i - 1] - L[i])
    su += t
    a[i] = t
su += abs(L[-1])

if L[0] * L[1] <= 0:
    print((su - abs(L[0]) * 2))
else:
    if L[0] < 0:
        if L[0] > L[1]:
            print(su)
        else:
            print((su - a[1] * 2))
    else:
        if L[0] < L[1]:
            print(su)
        else:
            print((su - a[1] * 2))

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

    t = 0
    if L[i - 1] * L[i + 1] < 0:
        t = abs(L[i - 1]) + abs(L[i + 1])
    else:
        t = abs(L[i - 1] - L[i + 1])

    print((su - c + t))

if L[-2] * L[-1] <= 0:
    print((su - abs(L[-1]) * 2))
else:
    if L[-1] < 0:
        if L[-1] > L[-2]:
            print(su)
        else:
            print((su - a[-1] * 2))
    else:
        if L[-1] < L[-2]:
            print(su)
        else:
            print((su - a[-1] * 2))

# Optimized solution
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = list(map(int, input().split()))
L = [int(v) for v in input().split()]
# L = [int(input()) for _ in range(Q)]
# S = input().strip()

L = [0] + L + [0]

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

for i in range(1, N + 1):
    print((su + abs(L[i - 1] - L[i + 1]) - abs(L[i - 1] - L[i]) - abs(L[i] - L[i + 1])))
# Original solution
n=int(eval(input()))
l=[0]+list(map(int,input().split()))+[0]
s=sum(abs(l[i+1]-l[i]) for i in range(n+1))
for i in range(n):
  a,b,c=l[i:i+3]
  print((s-min(abs(b-c),abs(b-a))*2*(max(a,c)<b or min(a,c)>b)))

# Optimized solution
n=int(eval(input()))
l=[0]+list(map(int,input().split()))+[0]
s=sum(abs(l[i+1]-l[i]) for i in range(n+1))
for i in range(n):
  a,b,c=l[i:i+3]
  print((s-abs(b-a)-abs(c-b)+abs(c-a)))