N = int(eval(input()))

A = [int(i) for i in input().split()]



dp = [(0, -1e10)] * (N + 1)

for i in range(N):

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

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

    dp[i + 1] = (a, b)



print((dp[N][0]))
N = int(eval(input()))

A = [int(i) for i in input().split()]



a, b = 0, -1e10

for ai in A:

    a, b = max(a + ai, b - ai), max(a - ai, b + ai)



print(a)
N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [(0, -1e10)] * (N + 1)
for i in range(N):
    a = max(dp[i][0] + A[i], dp[i][1] - A[i])
    b = max(dp[i][0] - A[i], dp[i][1] + A[i])
    dp[i + 1] = (a, b)
print((dp[N][0]))

N = int(eval(input()))
A = [int(i) for i in input().split()]
a, b = 0, -1e10
for ai in A:
    a, b = max(a + ai, b - ai), max(a - ai, b + ai)
print(a)

-dp = [(0, -1e10)] * (N + 1) -for i in range(N): -    a = max(dp[i][0] + A[i], dp[i][1] - A[i]) -    b = max(dp[i][0] - A[i], dp[i][1] + A[i]) -    dp[i + 1] = (a, b) -print((dp[N][0])) +a, b = 0, -1e10 +for ai in A: +    a, b = max(a + ai, b - ai), max(a - ai, b + ai) +print(a)