N = int(eval(input()))

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



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

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

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, *A = list(map(int, open(0).read().split()))



p = 0; q = -10**18

for a in A:

    p, q = max(p + a, q - a), max(p - a, q + a)

print(p)
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
dp = [[0, 0] for i in range(N + 1)]
dp[0][1] = -(10**18)
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, *A = list(map(int, open(0).read().split()))
p = 0
q = -(10**18)
for a in A:
    p, q = max(p + a, q - a), max(p - a, q + a)
print(p)

-N = int(eval(input())) -(*A,) = list(map(int, input().split())) -dp = [[0, 0] for i in range(N + 1)] -dp[0][1] = -(10**18) -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, *A = list(map(int, open(0).read().split())) +p = 0 +q = -(10**18) +for a in A: +    p, q = max(p + a, q - a), max(p - a, q + a) +print(p)