N = int(eval(input()))

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



dp = [[0] * 2 for i in range(N)]

dp[0][0] = A[0] + A[1]

dp[0][1] = -A[0] - A[1]



for i in range(1, N - 1):

    for j in range(2):

        if j == 0:

            dp[i][j] = max(dp[i-1][0] + A[i+1], dp[i-1][1] + A[i+1])

        else:

            dp[i][j] = max(dp[i-1][0] - 2 * A[i] - A[i+1], dp[i-1][1] + 2 * A[i] - A[i+1])



print((max(dp[N-2])))
N = int(eval(input()))

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



dp = [[0] * 2 for i in range(N+1)]



dp[0][1] = - 10 ** 18



for i in range(N):

    for j in range(2):

        if j == 0:

            dp[i+1][j] = max(dp[i][0] + A[i], dp[i][1] - A[i])

        else:

            dp[i+1][j] = max(dp[i][0] - A[i], dp[i][1] + A[i])



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

N = int(eval(input()))
A = list(map(int, input().split()))
dp = [[0] * 2 for i in range(N + 1)]
dp[0][1] = -(10**18)
for i in range(N):
    for j in range(2):
        if j == 0:
            dp[i + 1][j] = max(dp[i][0] + A[i], dp[i][1] - A[i])
        else:
            dp[i + 1][j] = max(dp[i][0] - A[i], dp[i][1] + A[i])
print((dp[N][0]))

-dp = [[0] * 2 for i in range(N)] -dp[0][0] = A[0] + A[1] -dp[0][1] = -A[0] - A[1] -for i in range(1, N - 1): +dp = [[0] * 2 for i in range(N + 1)] +dp[0][1] = -(10**18) +for i in range(N): -            dp[i][j] = max(dp[i - 1][0] + A[i + 1], dp[i - 1][1] + A[i + 1]) +            dp[i + 1][j] = max(dp[i][0] + A[i], dp[i][1] - A[i]) -            dp[i][j] = max( -                dp[i - 1][0] - 2 * A[i] - A[i + 1], dp[i - 1][1] + 2 * A[i] - A[i + 1] -            ) -print((max(dp[N - 2]))) +            dp[i + 1][j] = max(dp[i][0] - A[i], dp[i][1] + A[i]) +print((dp[N][0]))