n = int(eval(input()))

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



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



# dp[i + 1][j] := i 番目までの最大値（j = 1 なら a[i] の符号反転）



dp[0][1] = -float("inf")

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[n][0]))
n = int(eval(input()))

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



b = []

count = 0

for i in a:

    if i < 0:

        count += 1

    b.append(abs(i))



if count % 2:

    print((sum(b) - 2 * min(b)))

else:

    print((sum(b)))
n = int(eval(input()))
a = list(map(int, input().split()))
dp = [[0] * 2 for i in range(n + 1)]
# dp[i + 1][j] := i 番目までの最大値（j = 1 なら a[i] の符号反転）
dp[0][1] = -float("inf")
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[n][0]))

n = int(eval(input()))
a = list(map(int, input().split()))
b = []
count = 0
for i in a:
    if i < 0:
        count += 1
    b.append(abs(i))
if count % 2:
    print((sum(b) - 2 * min(b)))
else:
    print((sum(b)))

-dp = [[0] * 2 for i in range(n + 1)] -# dp[i + 1][j] := i 番目までの最大値（j = 1 なら a[i] の符号反転） -dp[0][1] = -float("inf") -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[n][0])) +b = [] +count = 0 +for i in a: +    if i < 0: +        count += 1 +    b.append(abs(i)) +if count % 2: +    print((sum(b) - 2 * min(b))) +else: +    print((sum(b)))