N = int(eval(input()))

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

#偶数個しか正負反転できない

#小さい順に並べてマイナスは全部、境界は判定

S = sorted([[i,A[i]] for i in range(N)],key=lambda x: x[1])

judge = [False]*N

for j in range(0,N-1,2):

    if S[j][1]+S[j+1][1]<0:

        judge[S[j][0]] = True

        judge[S[j+1][0]] = True

for i in range(N-1):

    if judge[i]:

        A[i] *= -1

        A[i+1] *= -1

        judge[i+1] ^= True

print((sum(A)))
N = int(eval(input()))

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

#アルゴリズム（動的計画法）で殴る解法

INF = float("inf")

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

dp[0][1] = -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()))
# 偶数個しか正負反転できない
# 小さい順に並べてマイナスは全部、境界は判定
S = sorted([[i, A[i]] for i in range(N)], key=lambda x: x[1])
judge = [False] * N
for j in range(0, N - 1, 2):
    if S[j][1] + S[j + 1][1] < 0:
        judge[S[j][0]] = True
        judge[S[j + 1][0]] = True
for i in range(N - 1):
    if judge[i]:
        A[i] *= -1
        A[i + 1] *= -1
        judge[i + 1] ^= True
print((sum(A)))

N = int(eval(input()))
A = list(map(int, input().split()))
# アルゴリズム（動的計画法）で殴る解法
INF = float("inf")
dp = [[0, 0] for _ in range(N + 1)]
dp[0][1] = -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]))

-# 偶数個しか正負反転できない -# 小さい順に並べてマイナスは全部、境界は判定 -S = sorted([[i, A[i]] for i in range(N)], key=lambda x: x[1]) -judge = [False] * N -for j in range(0, N - 1, 2): -    if S[j][1] + S[j + 1][1] < 0: -        judge[S[j][0]] = True -        judge[S[j + 1][0]] = True -for i in range(N - 1): -    if judge[i]: -        A[i] *= -1 -        A[i + 1] *= -1 -        judge[i + 1] ^= True -print((sum(A))) +# アルゴリズム（動的計画法）で殴る解法 +INF = float("inf") +dp = [[0, 0] for _ in range(N + 1)] +dp[0][1] = -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]))