N = int(eval(input()))

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

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

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



for i in range(N):

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

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



print((dp[-1][0]))

N = int(eval(input()))

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

dp = [0, -10**20]

tmp = [0, 0]



for i in range(N):

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

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

    dp[0], dp[1] = tmp[0], tmp[1]

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

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

-dp = [[0, 0] for i in range(N + 1)] -dp[0][1] = -(10**20) +dp = [0, -(10**20)] +tmp = [0, 0] -    dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i]) -    dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i]) -print((dp[-1][0])) +    tmp[0] = max(dp[0] + A[i], dp[1] - A[i]) +    tmp[1] = max(dp[0] - A[i], dp[1] + A[i]) +    dp[0], dp[1] = tmp[0], tmp[1] +print((dp[0]))