import sys

import numpy as np 



n, *a = map(int, sys.stdin.read().split())

a = np.array([0] + a + [0])



def main():

    res1 = np.absolute(a[2:] - a[1:-1]) + np.absolute(a[1:-1] - a[:-2])

    res2 = np.absolute(a[2:] - a[:-2])

    default = np.absolute(a[1:] - a[:-1]).sum()

    

    ans = default - (res1 - res2)

    return ans



if __name__ == '__main__':

    ans = main()

    print(*ans, sep='\n')

import sys



n, *a = list(map(int, sys.stdin.read().split()))

a = [0] + a + [0]



def main():

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

    for i in range(1, n + 1):

        if a[i-1] <= a[i] <= a[i+1]: res = s

        elif a[i-1] >= a[i] >= a[i+1]: res = s

        else: res = s - 2 * min(abs(a[i] - a[i-1]), abs(a[i+1] - a[i]))

        print(res)

            

if __name__ ==  '__main__':

    main()
import sys
import numpy as np

n, *a = map(int, sys.stdin.read().split())
a = np.array([0] + a + [0])


def main():
    res1 = np.absolute(a[2:] - a[1:-1]) + np.absolute(a[1:-1] - a[:-2])
    res2 = np.absolute(a[2:] - a[:-2])
    default = np.absolute(a[1:] - a[:-1]).sum()
    ans = default - (res1 - res2)
    return ans


if __name__ == "__main__":
    ans = main()
    print(*ans, sep="\n")

import sys

n, *a = list(map(int, sys.stdin.read().split()))
a = [0] + a + [0]


def main():
    s = sum([abs(a[i + 1] - a[i]) for i in range(n + 1)])
    for i in range(1, n + 1):
        if a[i - 1] <= a[i] <= a[i + 1]:
            res = s
        elif a[i - 1] >= a[i] >= a[i + 1]:
            res = s
        else:
            res = s - 2 * min(abs(a[i] - a[i - 1]), abs(a[i + 1] - a[i]))
        print(res)


if __name__ == "__main__":
    main()

-import numpy as np -n, *a = map(int, sys.stdin.read().split()) -a = np.array([0] + a + [0]) +n, *a = list(map(int, sys.stdin.read().split())) +a = [0] + a + [0] -    res1 = np.absolute(a[2:] - a[1:-1]) + np.absolute(a[1:-1] - a[:-2]) -    res2 = np.absolute(a[2:] - a[:-2]) -    default = np.absolute(a[1:] - a[:-1]).sum() -    ans = default - (res1 - res2) -    return ans +    s = sum([abs(a[i + 1] - a[i]) for i in range(n + 1)]) +    for i in range(1, n + 1): +        if a[i - 1] <= a[i] <= a[i + 1]: +            res = s +        elif a[i - 1] >= a[i] >= a[i + 1]: +            res = s +        else: +            res = s - 2 * min(abs(a[i] - a[i - 1]), abs(a[i + 1] - a[i])) +        print(res) -    ans = main() -    print(*ans, sep="\n") +    main()