from numpy import zeros



inf = float('inf')



n = int(eval(input()))

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



dp = zeros((n + 1, 2))

dp[0][1] = -inf

# dp[idx][マイナスを使う必要がある個数]



for i, aa in enumerate(a):

    if aa >= 0:

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

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

    else:

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

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



# print(dp)

print((int(dp[n][0])))

from bisect import bisect_left



n = int(eval(input()))

a = tuple(sorted(map(int, input().split())))

b = tuple(sorted(map(abs, a)))



j = bisect_left(a, 0)

m = a[:j]



if len(m) % 2 == 0:

    print((sum(b)))

else:

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

from numpy import zeros

inf = float("inf")
n = int(eval(input()))
a = tuple(map(int, input().split()))
dp = zeros((n + 1, 2))
dp[0][1] = -inf
# dp[idx][マイナスを使う必要がある個数]
for i, aa in enumerate(a):
    if aa >= 0:
        dp[i + 1][0] = max(dp[i][0] + aa, dp[i][1] - aa)
        dp[i + 1][1] = max(dp[i][1] + aa, dp[i][0] - aa)
    else:
        dp[i + 1][0] = max(dp[i][1] - aa, dp[i][0] + aa)
        dp[i + 1][1] = max(dp[i][0] - aa, dp[i][1] + aa)
# print(dp)
print((int(dp[n][0])))

from bisect import bisect_left

n = int(eval(input()))
a = tuple(sorted(map(int, input().split())))
b = tuple(sorted(map(abs, a)))
j = bisect_left(a, 0)
m = a[:j]
if len(m) % 2 == 0:
    print((sum(b)))
else:
    print((sum(b) - min(b) * 2))

-from numpy import zeros +from bisect import bisect_left -inf = float("inf") -a = tuple(map(int, input().split())) -dp = zeros((n + 1, 2)) -dp[0][1] = -inf -# dp[idx][マイナスを使う必要がある個数] -for i, aa in enumerate(a): -    if aa >= 0: -        dp[i + 1][0] = max(dp[i][0] + aa, dp[i][1] - aa) -        dp[i + 1][1] = max(dp[i][1] + aa, dp[i][0] - aa) -    else: -        dp[i + 1][0] = max(dp[i][1] - aa, dp[i][0] + aa) -        dp[i + 1][1] = max(dp[i][0] - aa, dp[i][1] + aa) -# print(dp) -print((int(dp[n][0]))) +a = tuple(sorted(map(int, input().split()))) +b = tuple(sorted(map(abs, a))) +j = bisect_left(a, 0) +m = a[:j] +if len(m) % 2 == 0: +    print((sum(b))) +else: +    print((sum(b) - min(b) * 2))