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.
[{"code": "N=int(input())\nA=list(map(int,input().split()))\n\nSUM=abs(A[0])\nfor i in range(N):\n  if i < N-1:\n    SUM += abs(A[i+1]-A[i])\n  else:\n    SUM += abs(0-A[i])\n\nnow=0\nfor i in range(N):\n  if i != N-1:\n    diff = abs(A[i+1]-now)-abs(A[i]-now)-abs(A[i+1]-A[i])\n    now = A[i]\n  else:\n    diff = abs(0-now)-abs(A[i]-now)-abs(0-A[i])\n  print(SUM + diff)", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "n = int(input())\nA = [0] + list(map(int, input().split())) + [0]\n\ncost = 0\nfor i in range(n+1):\n    cost += abs(A[i] - A[i+1])\n\nfor i in range(1, n+1):\n    ans = cost\n    ans -= abs(A[i] - A[i-1])\n    ans -= abs(A[i] - A[i+1])\n    ans += abs(A[i-1] - A[i+1])\n    print(ans)", "passed": true, "time": 0.16, "memory": 14068.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nA.append(0)\nA.insert(0,0)\nS = 0\n\nfor i in range(len(A)-1):\n    S+=abs(A[i+1]-A[i])#\u7dcf\u30b3\u30b9\u30c8\n    \nfor i in range(1,N+1):\n    print((S-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])))\n\n\n\n", "passed": true, "time": 0.22, "memory": 14236.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\nd=0\na = [0] + a + [0]\nfor j in range(len(a)-1):\n    d += abs(a[j]-a[j+1])\n\nfor i in range(1, len(a)-1):\n    if a[i-1] <= a[i] <= a[i+1] or a[i-1] >= a[i] >= a[i+1]:\n        print(d)\n    else:\n        print(d - abs(a[i-1]-a[i]) - abs(a[i+1]-a[i]) + abs(a[i-1]-a[i+1]))", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nj = abs(A[0]) + abs(A[N-1])\nfor i in range(N-1):\n    j += abs(A[i]-A[i+1])\nfor i in range(N):\n    if i == 0:\n        ans = j-abs(A[0])-abs(A[0]-A[1])+abs(A[1])\n    elif i == N-1:\n        ans = j-abs(A[N-2]-A[N-1])-abs(A[N-1])+abs(A[N-2])\n    else:\n        ans = j - abs(A[i]-A[i-1]) - abs(A[i]-A[i+1]) + abs(A[i-1]-A[i+1])\n    print(ans)", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\narr = [0] + list(map(int, input().split())) + [0]\nsum_arr = sum(abs(arr[i] - arr[i+1]) for i in range(n+1))\n\nfor i in range(1, n+1):\n    diff = abs(arr[i-1] - arr[i]) + abs(arr[i] - arr[i+1])\\\n               - abs(arr[i-1] - arr[i+1])\n    print(sum_arr - diff)", "passed": true, "time": 0.24, "memory": 14316.0, "status": "done"}, {"code": "n=int(input())\nc=list(map(int, input().split()))\nc = [0] + c + [0]\nans = 0\n\nfor i in range(n+1):\n    ans += abs(c[i+1]-c[i])\n\nfor i in range(n):\n    d = abs(c[i+1]-c[i])+ abs(c[i+2]-c[i+1])\n    e = abs(c[i+2]-c[i])\n    print(ans - d + e)", "passed": true, "time": 0.14, "memory": 14036.0, "status": "done"}, {"code": "n = int(input())\nspot = [0] + list(map(int, input().split())) + [0]\nplst = [0] * n\ndissum = 0\nfor i in range(1, n + 1):\n  plst[i - 1] = (abs(spot[i + 1] - spot[i - 1])) - (abs(spot[i + 1] - spot[i]) + abs(spot[i] - spot[i - 1]))\n  dissum += abs(spot[i] - spot[i - 1])\ndissum += abs(spot[n])\nfor i in range(n):\n  print(dissum + plst[i])", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "n=int(input())\nl=[0]+list(map(int,input().split()))+[0]\nd=[abs(a-b) for a,b in zip(l,l[1:])]\nm=sum(d)\nfor i in range(n):\n    print((m+abs(l[i]-l[i+2])-(d[i]+d[i+1])))\n", "passed": true, "time": 0.23, "memory": 14092.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na = [0] + a + [0]\ntnp = 0\nfor i in range(1,n+2):\n    tnp += abs(a[i]-a[i-1])\nfor i in range(n):\n    ans = tnp - abs(a[i+1]-a[i]) - abs(a[i+2]-a[i+1]) + abs(a[i+2]-a[i])\n    print(ans)", "passed": true, "time": 0.19, "memory": 14092.0, "status": "done"}, {"code": "import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nINF = 10**9\nmod = 10**9+7\n\nN = i()\nA = [0]+l()+[0]\nd = []\nfor i in range(N+1):\n    d.append(abs(A[i+1]-A[i]))\nans = sum(d)\nfor i in range(N):\n    print(ans+abs(A[i]-A[i+2])-d[i]-d[i+1])", "passed": true, "time": 0.15, "memory": 14308.0, "status": "done"}, {"code": "N = int(input())\nA = list(int(a) for a in input().split())\nA = [0] + A + [0]\n\ndist = [0]\nfor i in range(1, N+2):\n    dist.append(abs(A[i]-A[i-1]))\n\ndist_cum = [0] * (N+2)\nfor i in range(N+1):\n    dist_cum[i+1] = dist_cum[i] + dist[i+1]\n\nfor i in range(1, N+1):\n    if A[i-1] < A[i] and A[i] < A[i+1]:\n        print((dist_cum[-1]))\n    elif A[i-1] > A[i] and A[i] > A[i+1]:\n        print((dist_cum[-1]))\n    else:\n        tmp = dist_cum[i-1]\n        tmp += dist_cum[-1] - dist_cum[i+1]\n        tmp += abs(A[i+1] - A[i-1])\n        print(tmp)\n", "passed": true, "time": 0.24, "memory": 14172.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nB = A[:]\nB.insert(0, 0)\nB.append(0)\n\nsum = 0\n\nfor i in range(N+1):\n  sum += abs(B[i+1] - B[i])\n  \nfor i in range(N):\n  #\u7acb\u3061\u5bc4\u308b\n  x = abs(B[i+1] - B[i]) + abs(B[i+2] - B[i+1])\n  #\u7acb\u3061\u5bc4\u3089\u306a\u3044\n  y = abs(B[i+2] - B[i])\n  print(sum - x + y)", "passed": true, "time": 0.22, "memory": 14232.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\na.insert(n,0)\na.insert(0,0)\nt = 0\ntmp = 0\nfor i in range(n+1):\n  t += abs(a[i+1]-a[i])\nfor i in range(1,n+1):\n  tmp = t\n  tmp -= abs(a[i]-a[i-1])+abs(a[i+1]-a[i])\n  tmp += abs(a[i+1]-a[i-1])\n  print(tmp)\n\n  \n  \n  \n\n", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na = [0] + a + [0]\n\nmax_fee = 0\nfor i in range(1, n + 2):\n    max_fee += abs(a[i] - a[i - 1])\n\nfor i in range(1, n + 1):\n    res = max_fee - abs(a[i] - a[i - 1]) - \\\n        abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1])\n    print(res)\n", "passed": true, "time": 0.16, "memory": 14360.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    inlis = list(map(int, input().split()))\n\n    total = 0\n    mae = 0\n\n    for i in range(n):\n        total += abs(inlis[i] - mae)\n        mae = inlis[i]\n    total += abs(inlis[-1])\n    inlis.append(0)\n\n    #i = 0\n    if 0 <= inlis[0] and inlis[0] > inlis[1]:\n        if inlis[1] >0:\n            print(total - 2 * abs(inlis[1] - inlis[0]))\n        else:\n            print(total - 2 * abs(inlis[0]))\n    elif 0 >= inlis[0] and inlis[0]< inlis[1]:\n        if inlis[1] < 0:\n            print(total - 2 * abs(inlis[1] - inlis[0]))\n        else:\n            print(total - 2 * abs(inlis[0]))\n    else:\n        print(total)\n\n    for j in range(1, n):\n        if inlis[j-1] <= inlis[j] <= inlis[j+1] or inlis[j-1]>= inlis[j] >= inlis[j+1]:\n            print(total)\n        elif inlis[j-1] <= inlis[j] and inlis[j] > inlis[j+1]:\n            if inlis[j-1] >= inlis[j+1]:\n                print(total - 2 * abs(inlis[j-1] - inlis[j]))\n            else:\n                print(total- 2 * abs(inlis[j+1] - inlis[j]))\n        elif inlis[j-1]>= inlis[j] and inlis[j] < inlis[j+1]:\n            if inlis[j-1] >= inlis[j+1]:\n                print(total - 2 * abs(inlis[j+1] - inlis[j]))\n            else:\n                print(total - 2 * abs(inlis[j-1] - inlis[j]))\n    \n\n\n\n        \n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int, input().split()))\nX.append(0)\nload = 0\nnow = 0\nfor i in range(N + 1):\n  load += abs(X[i] - now)\n  now = X[i]\n  \n#print(load)  \n\nnow = 0\nfor i in range(N):\n  if now <= X[i] <= X[i + 1]:\n    print(load)\n  elif X[i + 1] <= X[i] <= now:\n    print(load)\n  else:\n    ll = 2 * min(abs(X[i] - now), abs(X[i] - X[i + 1]))\n    print((load - ll))\n  now = X[i]   \n    \n    \n    \n    \n    \n\n\n\n\n\n\n", "passed": true, "time": 0.15, "memory": 14116.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na = [0] + a + [0]\n\nmax_fee = 0\nfor i in range(1, n + 2):\n    max_fee += abs(a[i] - a[i - 1])\n\nfor i in range(1, n + 1):\n    if a[i - 1] <= a[i] <= a[i + 1] or a[i + 1] <= a[i] <= a[i - 1]:\n        print(max_fee)\n    else:\n        res = max_fee - min(abs(a[i + 1] - a[i]) * 2, abs(a[i] - a[i - 1]) * 2)\n        print(res)\n", "passed": true, "time": 0.15, "memory": 14412.0, "status": "done"}, {"code": "n = int(input())\nal = list(map(int, input().split()))\n\nres = 0\n\nal.append(0)\nal.insert(0,0)\n\nfor i in range(n+1):\n    res += abs(al[i+1]-al[i])\n\nfor j in range(1,n+1):\n    if (al[j+1]-al[j]) * (al[j]-al[j-1]) >= 0:\n        print(res)\n    else:\n        print(res - min(abs(al[j+1]-al[j]),abs(al[j]-al[j-1]))*2)", "passed": true, "time": 0.15, "memory": 14100.0, "status": "done"}, {"code": "import sys\n\n\nstdin = sys.stdin\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(stdin.readline().rstrip())\ndef nm(): return list(map(int, stdin.readline().split()))\ndef nl(): return list(map(int, stdin.readline().split()))\n\n\ndef main():\n    n = ni()\n    A = nl()\n    total = sum([abs(A[i + 1] - A[i]) for i in range(n - 1)])\n    for i in range(n):\n        if i == 0:\n            start = abs(A[1])\n            end = abs(A[-1])\n            print((total - abs(A[1] - A[0]) + start + end))\n        elif i == n - 1:\n            start = abs(A[0])\n            end = abs(A[-2])\n            print((total - abs(A[-2] - A[-1]) + start + end))\n        else:\n            start = abs(A[0])\n            end = abs(A[-1])\n            print((total - abs(A[i - 1] - A[i]) -\n                  abs(A[i] - A[i + 1]) + abs(A[i + 1] - A[i - 1])\n                  + start + end))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "N = int(input())\nA = [0] + list(map(int,input().split())) + [0]\nB = [0] * (N+1)\ntotal = 0\nfor i in range(N+1):\n    B[i] = A[i+1]-A[i]\n    total += abs(B[i])\nfor i in range(N):\n    print((total - (abs(B[i])+abs(B[i+1])) + abs(B[i]+B[i+1])))\n", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "from copy import deepcopy\nn=int(input())\nA=list(map(int, input().split()))\nB=[0]+deepcopy(A)+[0]\ntotal=0\nb=0\nfor a in A:\n    total+=abs(a-b)\n    b=a\ntotal+=abs(b)\nfor i in range(1,n+1):\n    z,x,c=B[i-1], B[i], B[i+1]\n    print(total-abs(x-z)-abs(c-x)+abs(c-z))", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    a = list(map(int, input().split()))\n    a.append(0)\n\n    base = abs(a[0])\n    for i in range(n):\n        base += abs(a[i+1] - a[i])\n    \n    ans = []\n    for i in range(n):\n        if (a[i] - a[i-1]) * (a[i+1] - a[i]) >= 0:\n            ans.append(base)\n        else:\n            ans.append(base - 2 * min(abs(a[i] - a[i-1]), abs(a[i+1] - a[i])))\n    \n    for i in ans:\n        print(i)\n\nmain()", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "N=int(input())\na=[0]+list(map(int,input().split()))+[0]\nsm = 0\nfor i in range(1,N+2):\n    sm += abs(a[i-1]-a[i])\nfor i in range(1,N+1):\n    print(sm-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i-1]-a[i+1]))", "passed": true, "time": 0.22, "memory": 14264.0, "status": "done"}, {"code": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n    N, *A = map(int, read().split())\n\n    B = [0]\n    B.extend(A)\n    B.append(0)\n\n    M = len(B)\n\n    total = 0\n    for i in range(M - 1):\n        total += abs(B[i + 1] - B[i])\n\n    ans = [0] * N\n    for i in range(N):\n        ans[i] = total - abs(B[i + 1] - B[i]) - abs(B[i + 2] - B[i + 1]) + abs(B[i + 2] - B[i])\n\n    print(*ans, sep='\\n')\n    return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\na = [0] + list(map(int, input().split())) + [0]\n\nres = [0]*(n+1)\nfor i in range(n+1):\n  res[i] = abs(a[i]-a[i+1])\n  \nt = sum(res)\nfor i in range(1, n+1):\n  ans = t - (res[i-1]+res[i]) + abs(a[i-1]-a[i+1])\n  print(ans)", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "n = int(input())\n\na = [int(i) for i in input().split()]\na.append(0)\na.insert(0,0)\n\ncost =0\nfor i in range(1,len(a)):\n    cost += abs(a[i-1] - a[i])\n\nfor i in range(1,len(a)-1):\n    if a[i-1] < a[i] < a[i+1]:\n        ans = cost\n    elif a[i-1] > a[i] > a[i+1]:\n        ans = cost\n    else:\n        ans = cost - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1])\n    print(ans)", "passed": true, "time": 0.25, "memory": 14168.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\nA.append(0)\nsum=0\nfor i in range(N+1):\n  if i==0:\n    sum+=abs(A[0])\n  else:\n    sum+=abs(A[i-1]-A[i])\nfor i in range(N):\n  if i==0:\n    print(sum+(abs(A[1])-abs(A[1]-A[0])-abs(A[0])))\n  else:\n    print(sum+(abs(A[i+1]-A[i-1])-abs(A[i+1]-A[i])-abs(A[i]-A[i-1])))", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\ncost = abs(a[0])\nfor i in range(1,n):\n    cost += abs(a[i]-a[i-1])\n#print(cost)\ncost+=abs(a[-1])\nans = [0]*n\n#print(cost)\n#ans[0] = cost - abs(a[1]-a[0])-abs(a[0])+abs(a[1])\nan =  cost - abs(a[1]-a[0])-abs(a[0])+abs(a[1])\n#ans[n] = cost - abs(a[n])\nprint(an)\nfor i in range(1,n-1):\n    key = cost-abs(a[i-1]-a[i])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])\n    #ans[i] = key\n    print(key)\nprint(cost-abs(a[-1])+abs(a[-2])-abs(a[-1]-a[-2]))", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n=int(input())\nA=[0]+list(map(int,input().split()))+[0]\nans = 0\nfor i in range(n+1):\n  ans += abs(A[i+1]-A[i])\nfor i in range(1,n+1):\n  print(ans-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+\n        abs(A[i+1]-A[i-1]))", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "N = int(input())\nA = [int(x) for x in input().split()]\nA.insert(0,0)\nA.append(0)\ncost = 0\nfor i in range(1,N+2):\n    cost += abs(A[i]-A[i-1])\n\ndef change(i):\n    nonlocal A\n    return -abs(A[i+1]-A[i])-abs(A[i]-A[i-1])+abs(A[i+1]-A[i-1])\n\nfor i in range(1,N+1):\n    print(cost+change(i))", "passed": true, "time": 0.22, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na = [0] + a + [0]\ntotal = 0\npre = 0\n\nfor i in a:\n    total += abs(i-pre)\n    pre = i\n\nfor i in range(1, len(a)-1):\n    print((total + abs(a[i+1]-a[i-1]) - abs(a[i]-a[i+1]) - abs(a[i]-a[i-1])))\n", "passed": true, "time": 0.22, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\nlst = list(map(int,input().split()))\n\ns = 0\ndiff_lst = []\nsign_lst = []\nfor i in lst + [0]:\n    diff = i - s\n    diff_lst.append(abs(diff))\n    sign_lst.append(1) if diff > 0 else sign_lst.append(-1)\n    s = i\n\nsu = sum(diff_lst)\nfor i in range(n):\n    if sign_lst[i] * sign_lst[i+1] > 0:\n        print(su)\n    else:\n        print(su - diff_lst[i] - diff_lst[i+1] + abs(diff_lst[i] - diff_lst[i+1]))", "passed": true, "time": 0.14, "memory": 14048.0, "status": "done"}, {"code": "n = int(input())\na = [0] + list(map(int, input().split())) + [0]\n\nnums = [0]*(n+1)\nfor i in range(1, n+2): nums[i-1] = abs(a[i] - a[i-1])\n\nans = sum(nums)\nfor i in range(1,n+1):\n  print(ans - nums[i-1]-nums[i]+abs(a[i+1]-a[i-1]))", "passed": true, "time": 0.25, "memory": 14172.0, "status": "done"}, {"code": "input()\na = [0] + list(map(int, input().split())) + [0]\na = [j - i for i, j in zip(a, a[1:])]\nx = sum(abs(i) for i in a)\nfor i, j in zip(a, a[1:]):\n    if i * j >= 0:\n        print(x)\n    else:\n        print(x - 2 * (min(abs(i), abs(j))))", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "N = int(input())\n*A, = map(int, input().split())\nA = [0] + A + [0]\nS = 0\nfor i in range(1, N+2):\n    S += abs(A[i] - A[i-1])\nfor i in range(1, N+1):\n    new = abs(A[i-1] - A[i+1])\n    pre_to_now = abs(A[i-1] - A[i])\n    now_to_next = abs(A[i] - A[i+1])\n    print(S - pre_to_now - now_to_next + new)", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "N = int(input())\nA = [0] + list(map(int, input().split())) + [0]\nS = sum(abs(A[i]-A[i+1]) for i in range(N+1))\nfor i in range(1, N+1):\n  print(S-(abs(A[i]-A[i-1])+abs(A[i+1]-A[i]))+abs(A[i+1]-A[i-1]))", "passed": true, "time": 0.19, "memory": 14284.0, "status": "done"}, {"code": "n = int(input())\nlis  =[0]+ list(map(int, input().split())) + [0]\n\ns = 0\nfor i in range(n+1):\n    tmp= abs(lis[i]-lis[i+1])\n    s += tmp\n\nfor i in range(1,n+1):\n    ans = s+abs(lis[i-1] - lis[i+1]) - (abs(lis[i-1]-lis[i]) +abs(lis[i] - lis[i+1]))\n    print(ans)", "passed": true, "time": 0.23, "memory": 14040.0, "status": "done"}, {"code": "n = int(input())\na = [0] + list(map(int,input().split())) + [0]\nans = 0\nfor i in range(n+1):\n    ans += abs(a[i]-a[i+1])\nfor i in range(1,n+1):\n    if (a[i-1] <= a[i] <= a[i+1]) or (a[i-1] >= a[i] >= a[i+1]):\n        print(ans)\n    else:\n        print(ans-2*min(abs(a[i-1]-a[i]), abs(a[i]-a[i+1])))", "passed": true, "time": 0.17, "memory": 14256.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na.append(0)\na.insert(0,0)\ns = 0\nfor i in range(len(a)-1):\n    s += abs(a[i]-a[i+1])\nfor h in range(1,n+1):\n    t = abs(a[h+1]-a[h-1])-abs(a[h]-a[h-1])-abs(a[h+1]-a[h])\n    print(s+t)", "passed": true, "time": 0.21, "memory": 14244.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Sep 22 16:34:00 2020\n\n@author: liang\n\"\"\"\n\nN = int(input())\nA = [0]+[int(x) for x in input().split()]+[0]\nans = 0\nfor i in range(N+1):\n    ans += abs(A[i+1] - A[i])\n\nfor i in range(1,N+1):\n    tmp = ans\n    if A[i-1] <= A[i] <= A[i+1]:\n        print(tmp)\n    elif A[i-1] >= A[i] >= A[i+1]:\n        print(tmp)\n    else:\n        tmp -= min(abs(A[i] - A[i-1]),abs(A[i+1] - A[i]))*2\n        print(tmp)", "passed": true, "time": 0.16, "memory": 14168.0, "status": "done"}, {"code": "# input\nN = int(input())\nA = list(map(int, input().split()))\n\nfull_root = [0] + A + [0]\nfull_place = [abs(full_root[i] - full_root[i + 1]) for i in range(N + 1)]\nfull_res = sum(full_place)\n# check\nfor ind in range(1, N + 1):\n    res = full_res - sum(full_place[ind - 1:ind + 1]) + abs(full_root[ind - 1] - full_root[ind + 1])\n\n    print(res)", "passed": true, "time": 0.24, "memory": 14204.0, "status": "done"}, {"code": "N=int(input())+2\nA=[0]\nA.extend(list(map(int,input().split())))\nA.append(0)\nB=sum(abs(A[i]-A[i-1]) for i in range(1,N))\nfor i in range(1,N-1):\n  print(B-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))", "passed": true, "time": 0.15, "memory": 14284.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\ntotal = 0\nfor i in range(1,n):\n    total += abs(a[i] - a[i-1])\n\ntotal +=  abs(a[0]) + abs(a[-1])\n\na.insert(0, 0)\na.append(0)\nfor i in range(1,n+1):\n    if a[i-1] <= a[i] and a[i] <= a[i+1]:\n        print(total)\n    elif a[i+1] <= a[i] and a[i] <= a[i-1]:\n        print(total)\n    elif max(a[i-1], a[i+1]) < a[i]:\n        print(total - abs(a[i] - max(a[i-1], a[i+1]))*2)\n    elif a[i] < min(a[i-1], a[i+1]):\n        print(total - abs(a[i] - min(a[i-1], a[i+1]))*2)", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\nA = [0] + a + [0]\n\ntotal_fee = 0\nfor i in range(N+1):\n    total_fee += abs(A[i+1]-A[i])\n\nans_lst = [total_fee] * N\nfor j in range(N):\n    ans_lst[j] -= abs(A[j+1]-A[j])\n    ans_lst[j] -= abs(A[j+2]-A[j+1])\n    ans_lst[j] += abs(A[j+2]-A[j])\n    print(ans_lst[j])", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "n = int(input())\na = [0] + list(map(int,input().split())) + [0]\nc = []\ntotal = 0\nfor i in range(n+1):\n    tmp = abs(a[i+1] - a[i])\n    c.append(tmp)\n    total += tmp\n    \nfor i in range(1,n+1):\n    ans = total - c[i-1] - c[i] + abs(a[i+1] - a[i-1])\n    print(ans)", "passed": true, "time": 0.25, "memory": 14164.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nA = [0] + A + [0]\n\ncost = [0] * (N + 2)\nfor i in range(N+1):\n  cost[i] += abs(A[i+1] - A[i])\n  \nsum_money = sum(cost)\n  \nskip = [0] * N\nfor j in range(N):\n  skip[j] += abs(A[j+2] - A[j])\n  \nfor k in range(N):\n  print(sum_money - (cost[k] + cost[k+1]) + skip[k])", "passed": true, "time": 0.15, "memory": 14388.0, "status": "done"}, {"code": "n = int(input())\nAs = list(map(int, input().split()))\nS = 0\nfor i in range(n-1):\n  S += abs(As[i]-As[i+1])\nS += abs(As[0]) + abs(As[n-1])\nfor i in range(n):\n  if i == 0:\n    sb1 = abs(As[i])\n    sb2 = abs(As[i]-As[i+1])\n    ad = abs(As[i+1])\n  elif i == n-1:\n    sb1 = abs(As[i-1]-As[i])\n    sb2 = abs(As[i])\n    ad = abs(As[i-1])\n  else:\n    sb1 = abs(As[i-1]-As[i])\n    sb2 = abs(As[i]-As[i+1])\n    ad = abs(As[i-1]-As[i+1])\n    \n  ans = S - sb1 - sb2 + ad\n  print(ans)\n", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "n = int(input())\na = [0] + list(map(int, input().split())) + [0]\n\nnums = [0]*(n+1)\nfor i in range(n+1): nums[i] = abs(a[i]-a[i+1])\n\ntotal = sum(nums)\nfor i in range(n):\n  ans = total - nums[i] - nums[i+1] + abs(a[i]-a[i+2])\n  print(ans)", "passed": true, "time": 0.13, "memory": 14320.0, "status": "done"}, {"code": "import sys\nimport heapq, math\nfrom itertools import zip_longest, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate, dropwhile, takewhile, groupby\nfrom functools import lru_cache\nfrom copy import deepcopy\n\nN = int(input())\n\nA = [0] + list(map(int, input().split())) + [0]\n\nS = 0\nfor i in range(N + 1):\n    S += abs(A[i] - A[i + 1])\n\nfor i in range(N):\n    print((S - abs(A[i] - A[i + 1]) - abs(A[i + 1] - A[i + 2]) + abs(A[i] - A[i + 2])))\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "n = int(input())\nA = [0]\na = list(map(int, input().split()))\nfor a_ in a:\n    A.append(a_)\ns = 0\nA.append(0)\nfor i in range(n+1):\n    s += abs(A[i+1]-A[i])\n\nfor i in range(1, n+1):\n    print(s + abs(A[i+1]-A[i-1]) - (abs(A[i+1]-A[i]) + abs(A[i]-A[i-1])))", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    a_lst = list(map(int, input().split()))\n\n    a_lst.insert(0, 0)\n    a_lst.append(0)\n    lst = []\n    for i in range(n + 1):\n        lst.append(abs(a_lst[i + 1] - a_lst[i]))\n\n    tmp = sum(lst)\n    tmp1 = sum(lst)\n    answer_lst = []\n    for i in range(n):\n        for j in range(2):\n            tmp1 -= lst[i + j]\n\n        tmp1 += abs(a_lst[i + 2] - a_lst[i])\n        answer_lst.append(tmp1)\n        tmp1 = tmp\n\n    for i in range(n):\n        print(answer_lst[i])\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 1.25, "memory": 14268.0, "status": "done"}, {"code": "import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom copy import deepcopy\ndef main():\n    n, *a = map(int, read().split())\n\n    if n == 2:\n        r = [abs(a[1] * 2), abs(a[0] * 2)]\n        print(*r, sep='\\n')\n        return\n\n    amin = min(a)\n    # \u5168ai\u3092\u79fb\u52d5\u3059\u308b\u30b3\u30b9\u30c8\u3092\u51fa\u3059\n    # \u4fbf\u5b9c\u306e\u305f\u3081\u3001a\u306e\u524d\u5f8c\u306b0\u5ea7\u6a19\u3092\u8ffd\u52a0\u3059\u308b\u3002\n    a.insert(0, 0)\n    a.append(0)\n    # \u5358\u7d14\u5316\u306e\u305f\u3081\u3001a\u306b\u30de\u30a4\u30ca\u30b9\u5ea7\u6a19\u304c\u3042\u308b(\uff1d\u5de6\u306e\u7aef\u304c\u30de\u30a4\u30ca\u30b9)\u306a\u3089\u3001\n    # \u5de6\u306e\u7aef\uff1d\u5ea7\u6a190\u306e\u30b3\u30d4\u30fc\u3092\u3064\u304f\u308b\u3002\u30de\u30a4\u30ca\u30b9\u3067\u306f\u306a\u3044\u306a\u3089\u5358\u7d14\u30b3\u30d4\u30fc\u3002\n    if amin < 0:\n        a2 = [i - amin for i in a] # amin\u304c\u6b63\u8ca0\u3069\u3061\u3089\u3067\u3082\u3053\u308c\u3067OK\n    else:\n        a2 = deepcopy(a)\n    # a\u3092\u5168\u3066\u56de\u3063\u305f\u5834\u5408\u306e\u30b3\u30b9\u30c8\u3092\u51fa\u3059\n    cost = 0\n    for i1 in range(n + 1):\n        cost += abs(a2[i1] - a2[i1 + 1])\n    # r\u306b\u7b54\u3092\u683c\u7d0d\u3059\u308b\u3002a\u306e\u524d\u5f8c\u306b\uff11\u8981\u7d20\u8db3\u3057\u3066\u3044\u308b\u306e\u3067\u9577\u3055\u3092\u5408\u308f\u305b\u308b\u3002\n    r = [cost] * (n + 2)\n    # a[i]\u305d\u308c\u305e\u308c\u3092\u30d1\u30b9\u3059\u308b\u5834\u5408\u306e\u30b3\u30b9\u30c8\u3092\u51fa\u3059\u3002\u5834\u5408\u5206\u3051\u3059\u308b\u3002\n    for j in range(1, n + 1):\n        if a2[j - 1] <= a2[j] <= a2[j + 1]:\n            continue\n        elif a2[j - 1] >= a2[j] >= a2[j + 1]:\n            continue\n        elif a2[j - 1] <= a2[j] and a2[j + 1] <= a2[j]:\n            nearer_dis = min(abs(a2[j - 1] - a2[j]), abs(a2[j] - a2[j + 1]))\n            r[j] -= nearer_dis * 2\n        else:\n            nearer_dis = min(abs(a2[j] - a2[j - 1]), abs(a2[j + 1] - a2[j]))\n            r[j] -= nearer_dis * 2\n    print(*r[1:-1], sep='\\n')\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "N=int(input())\n*A,=map(int,input().split())\n\nB=[0]+A+[0]\ncount=[0]*N\nS=abs(B[1]-0)\ni=1\nwhile i<=N:\n    if B[i-1]<=B[i]<=B[i+1] or B[i-1]>=B[i]>=B[i+1]:\n        count[i-1]=0\n    else:\n        count[i-1]=2*min(abs(B[i]-B[i-1]),abs(B[i+1]-B[i]))\n    S+=abs(B[i+1]-B[i])\n    i+=1\n\nfor c in count:\n    print(S-c)", "passed": true, "time": 0.14, "memory": 14400.0, "status": "done"}, {"code": "n = int(input())\na = [0]+list(map(int, input().split()))+[0]\n\nnums = [0]*(n+1)\nfor i in range(n+1): nums[i] = abs(a[i]-a[i+1])\n\nt = sum(nums)\nfor i in range(1,n+1):\n  ans = t - (nums[i-1]+nums[i]) + abs(a[i-1]-a[i+1])\n  print(ans)", "passed": true, "time": 0.14, "memory": 14212.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nD1 = []\nD2 = []\n\nD1.append(abs(A[0]))\nD2.append(abs(A[1]))\n\nfor i in range(1,N):\n  D1.append(abs(A[i]-A[i-1]))\nD1.append(abs(A[N-1]))\n\nfor i in range(1,N-1):\n  D2.append(abs(A[i+1]-A[i-1]))\nD2.append(abs(A[N-2]))\n\nS = sum(D1)\n\nfor i in range(N):\n  print(S-D1[i]-D1[i+1]+D2[i])", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "N = int(input())\nA = [0]+list(map(int,input().split()))+[0]\nplan = 0\nfor i in range(N+1):\n    plan += abs(A[i+1]-A[i])\nfor i in range(N):\n    difference = abs(A[i+2]-A[i+1])+abs(A[i+1]-A[i])-abs(A[i+2]-A[i])\n    print((plan-difference))\n", "passed": true, "time": 0.16, "memory": 14132.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\n\nsm_al=abs(a[0])+abs(a[n-1])\nfor i in range(n-1):\n    sm_al+=abs(a[i+1]-a[i])\n\n#a1\u306b\u884c\u304b\u306a\u3044\u3068\u304d\nsm1=sm_al-abs(a[1]-a[0])-abs(a[0])+abs(a[1])\nprint(sm1)\n#a2-an-1\u306b\u884c\u304b\u306a\u3044\u3068\u304d\nfor i in range(1,n-1):\n    sm=sm_al-abs(a[i+1]-a[i])-abs(a[i]-a[i-1])+abs(a[i+1]-a[i-1])\n    print(sm)\n#an\u306b\u884c\u304b\u306a\u3044\nsmn=sm_al-abs(a[n-1]-a[n-2])-abs(a[n-1])+abs(a[n-2])\nprint(smn)", "passed": true, "time": 0.41, "memory": 14124.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\n# 0 3 5 -1  0\n# 0 3 5 11 12\n#cum 0 3 8 14 15\n# 0   5 11 12\n# 0 3    7  8\n# 0 3 5    10\n\n# (cumi+1)-(cumi-1) - (i+1 - i-1)\n# 8-0 - 5-0\n# 14-3 - 7-3\n# 2 6 8\n# 3 2 5\n\na.insert(0,0)\na.append(0)\ndef cumulative_sum(collection):\n    result = [0]\n    for i in range(1, len(collection)):\n        item = abs(collection[i] - collection[i-1])\n        result.append(result[-1] + item)\n    return result\ncuma = cumulative_sum(a)\n\nlp=cuma[-1]\n\nfor i in range(n):\n    gap=abs(cuma[i+2]-cuma[i])-abs(a[i+2]-a[i])\n    print(lp-gap, flush=True)\n", "passed": true, "time": 0.43, "memory": 14248.0, "status": "done"}, {"code": "n = int(input())\na = [0] + [int(x) for x in input().split()] + [0]\ndiff = [abs(a[i] - a[i + 1]) for i in range(n + 1)]\ntot = sum(diff)\nfor i in range(1, n + 1):\n    print(tot - diff[i - 1] - diff[i] + abs(a[i - 1] - a[i + 1]))", "passed": true, "time": 0.15, "memory": 14140.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\nA.insert(0,0)\nA.append(0)\nx=0\nfor i in range(0,N+1):\n    x+=abs(A[i+1]-A[i])\nfor i in range(1,N+1):\n    print((x-abs(A[i]-A[i-1])-abs(A[i]-A[i+1])+abs(A[i+1]-A[i-1])))\n", "passed": true, "time": 0.15, "memory": 14268.0, "status": "done"}, {"code": "import sys\nimport copy\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int,input().split()))\nb = [0]\nfor i in range(N):\n    b.append(A[i])\nb.append(0)\n\nsumb= 0\nfor i in range(1,len(b)):\n    sumb += abs(b[i]-b[i-1])\n\nfor j in range(1,N+1):\n    sumc = sumb\n    sumc = sumc - abs(b[j+1]-b[j])-abs(b[j]-b[j-1])+abs(b[j+1]-b[j-1])\n    print(sumc)\n\n", "passed": true, "time": 0.31, "memory": 14136.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\nn = int(input())\na = list(map(int, input().split()))\n\na = [0] + a + [0]\n\ndiff = []\nfor i in range(1, len(a)):\n    diff.append(abs(a[i-1]-a[i]))\n\nans = sum(diff)\n\n# print(diff)\nfor i in range(1, len(diff)):\n    tmp = abs(a[i+1]-a[i-1])-abs(a[i]-a[i+1])-abs(a[i-1]-a[i])\n    print((ans+tmp))\n", "passed": true, "time": 0.21, "memory": 14160.0, "status": "done"}, {"code": "def cost(i, j=1):\n    return abs(a[i] - a[i+j])\n\nn = int(input())\na = [0] + [int(i) for i in input().split()] + [0]\n\nc = sum([cost(i) for i in range(n+1)])\nfor i in range(1, n+1):\n    print(c - cost(i-1) - cost(i) + cost(i-1, 2))", "passed": true, "time": 0.24, "memory": 14264.0, "status": "done"}, {"code": "n = int(input())\nAs = list(map(int, input().split()))\nais = [0]\nais.extend(As)\nm = 0\nais.append(m)\nS = 0\nfor i in range(n-1):\n  S += abs(As[i]-As[i+1])\nS += abs(As[0]) + abs(As[n-1])\nfor i in range(1,n+1):\n  sb1 = abs(ais[i-1]-ais[i])\n  sb2 = abs(ais[i]-ais[i+1])\n  ad = abs(ais[i-1]-ais[i+1])\n    \n  ans = S - sb1 - sb2 + ad\n  print(ans)\n", "passed": true, "time": 0.24, "memory": 14316.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split())) + [0]\nb = [abs(a[0])]+[abs(a[i+1]-a[i]) for i in range(n)]\nc = [abs(a[1])]+[abs(a[i+2]-a[i]) for i in range(n-1)]\n\nhon = sum(b)\n\nfor i in range(n):\n    print(hon-b[i]-b[i+1]+c[i])", "passed": true, "time": 0.21, "memory": 14352.0, "status": "done"}, {"code": "n=int(input())\na=[0]+list(map(int,input().split()))+[0]\nb=[]\nfor i in range(n+1):\n    b.append(abs(a[i+1]-a[i]))\ntemp=sum(b)\n\nfor j in range(n):\n    ans=temp-b[j]-b[j+1]+abs(a[j+2]-a[j])\n    print(ans)\n", "passed": true, "time": 0.21, "memory": 14224.0, "status": "done"}, {"code": "import sys\n\nN = int(input())\n\nA = list(map(int, input().split()))\nA.insert(0, 0)\nA.append(0)\n\nsum = 0\nfor i in range(1, N+2):\n    sum += abs(A[i]-A[i-1])\n\nfor i in range(1, N+1):\n    print((sum+abs(A[i-1]-A[i+1])-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])))\n", "passed": true, "time": 0.16, "memory": 14296.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\nA=[0]+A+[0]\nans=0\nfor i in range(1,N+2):\n    ans+=abs(A[i]-A[i-1])\nfor i in range(1,N+1):\n    Z=ans\n    Z-=(abs(A[i]-A[i-1])+abs(A[i]-A[i+1])-abs(A[i+1]-A[i-1]))\n    print(Z)", "passed": true, "time": 0.22, "memory": 14156.0, "status": "done"}, {"code": "N = int(input())\nA = [0]+list(map(int,input().split()))+[0]\nB = [abs(a-b) for a,b in zip(A,A[1:])]\nC = sum(B)\n\nfor n in range(N):\n  print(C+abs(A[n]-A[n+2])-(B[n]+B[n+1]))", "passed": true, "time": 0.15, "memory": 14364.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\n\nsum1=0\nfor x in range(n-1):\n  sum1+=abs(a[x]-a[x+1])\n  \nsum1+=abs(a[0])+abs(a[n-1])\nfor y in range(n):\n  if y==0:\n    print((sum1-abs(a[0])-abs(a[1]-a[0])+abs(a[1])))\n  elif y==n-1:\n    print((sum1-abs(a[n-1]-a[n-2])-abs(a[n-1])+abs(a[n-2])))\n  else:\n    print((sum1-abs(a[y]-a[y-1])-abs(a[y]-a[y+1])+abs(a[y-1]-a[y+1])))\n    \n\n", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "import math\nfrom math import gcd,pi,sqrt\nINF = float(\"inf\")\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return list(map(int, input().split()))\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\ndef main():\n    n = i_input()\n    a = i_list()\n\n    total = 0\n    now = 0\n    for i in a:\n        total += abs(now-i)\n        now = i\n    total += abs(i)\n    a.insert(0,0)\n    a.append(0)\n\n    ans = []\n\n    for i,k in enumerate(a[1:-1], start=1):\n        # print(i,k)\n\n        if a[i-1] <= k and k <= a[i+1] or a[i-1] >= k and  k >= a[i+1]:\n            ans.append(total)\n        else:\n            ans.append(total - abs(k-a[i-1]) - abs(k-a[i+1]) + abs(a[i-1]-a[i+1]))\n\n    for i in ans:\n        print(i)\n\n\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14320.0, "status": "done"}, {"code": "N = int(input())\nlsA = [0]+list(map(int,input().split()))+[0]\nsum1 = 0\nfor i in range(1,N+2):\n    sum1 += abs(lsA[i]-lsA[i-1])\nlsans = []\nfor i in range(1,N+1):\n    if lsA[i-1] <= lsA[i] and lsA[i] <= lsA[i+1]:\n        lsans.append(sum1)\n    elif lsA[i-1] >= lsA[i] and lsA[i] >= lsA[i+1]:\n        lsans.append(sum1)\n    else:\n        div = min(abs(lsA[i-1]-lsA[i]),abs(lsA[i+1]-lsA[i]))\n        lsans.append(sum1-2*div)\nfor i in lsans:\n    print(i)", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "N = int(input())\nA = [0]+[int(X) for X in input().split()]+[0]\nCost = sum(abs(A[T+1]-A[T]) for T in range(N+1))\nfor T in range(1,N+1):\n    Cut = Cost+abs(A[T+1]-A[T-1])-abs(A[T]-A[T-1])-abs(A[T+1]-A[T])\n    print(Cut)", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\n\ncost = abs(A[0])\nfor i in range(1, N):\n    cost += abs(A[i] - A[i - 1])\ncost += abs(A[N - 1])\n\nprev = 0\nA.append(0)\nfor i in range(N):\n    x = abs(A[i + 1] - prev)\n    y = abs(A[i] - prev) + abs(A[i + 1] - A[i])\n    print(cost - (y - x))\n    prev = A[i]", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "n=int(input())\na=[int(i) for i in input().split()]\na.append(0)\na=[0]+a\ntotal=0\n\nfor i in range(1,n+2):\n    total+=abs(a[i-1]-a[i])\n\ndef herasu(i):\n    ans=total-abs(a[i-1]-a[i])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])\n    return ans\n\n\nfor i in range(1,n+1):\n    print((herasu(i)))\n\n", "passed": true, "time": 0.23, "memory": 14088.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\nA.insert(0,0)\nA.append(0)\nx=0\nfor i in range(0,N+1):\n    x+=abs(A[i+1]-A[i])\nfor i in range(1,N+1):\n    print(x-abs(A[i]-A[i-1])-abs(A[i]-A[i+1])+abs(A[i+1]-A[i-1]))", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\n\nA = [0] + A + [0]\nsum_all = 0\n\nfor i, a in enumerate(A[1:N + 2], start=1):\n    sum_all += abs(a - A[i - 1])\n\nfor i, a in enumerate(A[1:N + 1], start=1):\n    print((sum_all - abs(a - A[i - 1]) - abs(a - A[i + 1]) + abs(A[i + 1] - A[i - 1])))\n\n", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "n = int(input())\na = [int(t) for t in input().split()]\na.insert(0,0)\na.append(0)\ns = 0\nfor i in range(1,n+2):\n  s += abs(a[i-1] - a[i])\nfor i in range(1,n+1):\n  if a[i-1] <= a[i] <= a[i+1] or a[i-1] >= a[i] >= a[i+1]:\n    print(s)\n  else:\n    res = s\n    res -= abs(a[i-1] - a[i])\n    res -= abs(a[i] - a[i+1])\n    res += abs(a[i-1] - a[i+1])\n    print(res)", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "n=int(input())\n#a,b=map(int,input().split())\nal=list(map(int,input().split()))\n#l=[list(map(int,input().split())) for i in range(n)]\nd=[0]\nd=d+al\nd.append(0)\ntotald=0\nfor i in range(1,n+2):\n    totald+=abs(d[i]-d[i-1])\n\nfor i in range(1,n+1):\n    minus=abs(d[i]-d[i-1])+abs(d[i+1]-d[i])\n    add=abs(d[i+1]-d[i-1])\n    print((totald-minus+add))\n", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\nm=[abs(0-A[0])]*(N+1)\nfor i in range(1,N):\n    m[i]=abs(A[i]-A[i-1])\nm[-1]=abs(0-A[-1])\na=sum(m)\nA.append(0)\nfor i in range(N):\n    print(a+abs(A[i-1]-A[i+1])-(abs(A[i-1]-A[i])+abs(A[i]-A[i+1])))", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "n = int(input())\na = [0] + list(map(int,input().split())) + [0]\nc = []\ntotal = 0\nfor i in range(n+1):\n    tmp = abs(a[i+1] - a[i])\n    c.append(tmp)\n    total += tmp\n\nfor i in range(1,n+1):\n    ans = total - c[i-1] - c[i] + abs(a[i+1] - a[i-1])\n    print(ans)", "passed": true, "time": 0.23, "memory": 14056.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\n\ntotal = abs(A[0]) + abs(A[-1])\nfor i in range(N-1):\n  total += abs(A[i]-A[i+1])\n  \nans = total-abs(A[0])-abs(A[0]-A[1])+abs(A[1])\nprint(ans)\nfor i in range(N-2):\n  ans = total-abs(A[i]-A[i+1])-abs(A[i+1]-A[i+2])+abs(A[i]-A[i+2])\n  print(ans)\nans = total-abs(A[-1])-abs(A[-1]-A[-2])+abs(A[-2])\nprint(ans)", "passed": true, "time": 0.22, "memory": 14288.0, "status": "done"}, {"code": "import sys\n\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\ndef solve():\n    n = ini()\n    a = inl()\n    a = [0] + a\n    a.append(0)\n\n    total = 0\n    for i in range(1, n + 2):\n        total += abs(a[i] - a[i - 1])\n    for i in range(1, n + 1):\n        diff = abs(a[i + 1] - a[i - 1]) - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i])\n        print(total + diff)\n\n\nsolve()\n", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "N = int(input())\nN_List = [0] +list(map(int,input().split())) + [0]\nN_Diff_List = []\n\nfor i in range(N+1):\n    N_Diff_List.append(abs(N_List[i+1]-N_List[i]))\n\nsumans = sum(N_Diff_List)\nfor i in range(N):\n    ans = sumans -(N_Diff_List[i] + N_Diff_List[i+1])\n    ans += abs(N_List[i+2]-N_List[i])\n    print(ans)\n", "passed": true, "time": 0.23, "memory": 14216.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\nd = [abs(a[0])]\nfor i in range(n-1):\n    d.append(abs(a[i+1] - a[i]))\n\nd.append(abs(a[-1]))\n\ns = sum(d)\n\nfor i in range(n):\n    if i == 0:\n        t = s - d[i] - d[i+1] + abs(a[i+1])\n    elif i == n-1:\n        t = s - d[i] - d[i+1] + abs(-a[i-1])\n    else:\n        t = s - d[i] - d[i+1] + abs(a[i+1] - a[i-1])\n    print(t)", "passed": true, "time": 0.14, "memory": 14428.0, "status": "done"}, {"code": "from itertools import accumulate\nN = int(input())\nA = [0] + list(map(int, input().split())) + [0]\ncost = sum(abs(A[i+1] - A[i]) for i in range(N+1))\nfor i in range(1, N+1):\n    print((cost + abs(A[i+1] - A[i-1]) - abs(A[i-1] - A[i]) - abs(A[i] - A[i+1])))\n", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na = [0] + a + [0]\n\nd_1 = []\nfor i in range(1, n+2):\n  d_1.append(abs(a[i]-a[i-1]))\nd_2 = []\nfor i in range(1, n+1):\n  d_2.append(abs(a[i+1]-a[i-1]))\n\ns_d = sum(d_1)\nfor i in range(1, n+1):\n  print((s_d - d_1[i-1] - d_1[i] + d_2[i-1]))\n", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "#!/usr/bin/env python\n\nn = int(input())\na = list(map(int, input().split()))\na = [0] + a + [0] \n\ntotal = 0 \nfor i in range(n+1):\n   total += abs(a[i]-a[i+1])\n\nfor i in range(1, n+1):\n    ans = total-(abs(a[i]-a[i-1])+abs(a[i+1]-a[i]))+abs(a[i+1]-a[i-1])\n    print(ans)\n", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "n = int(input())\nspot = [0] + list(map(int, input().split())) + [0]\nmlst = []\nplst = []\ndissum = 0\nfor i in range(1, n + 1):\n  mlst.append(abs(spot[i + 1] - spot[i]) + abs(spot[i] - spot[i - 1]))\n  plst.append(abs(spot[i + 1] - spot[i - 1]))\n  dissum += abs(spot[i] - spot[i - 1])\ndissum += abs(spot[n])\nfor i in range(n):\n  print(dissum - mlst[i] + plst[i])", "passed": true, "time": 0.14, "memory": 14192.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    As = [0] + list(map(int, input().split())) + [0]\n\n    cumsum = [0] * (n+1)\n    for i in range(1, n+2):\n        cumsum[i-1] = abs(As[i] - As[i-1])\n    cumsum_sum = sum(cumsum)\n    for i in range(1, n+1):\n        ans = cumsum_sum - cumsum[i-1] - cumsum[i] + abs(As[i+1] - As[i-1])\n        print(ans)\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}]