n=int(eval(input()))

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

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

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

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()))

cnt = sum([1 for i in a if i < 0])

if cnt%2:

  r = 10**9

  for i in range(n):

    r = min(r,abs(a[i]))

  print((sum([abs(x) for x in a])-2*r))  

else:

  print((sum([abs(x) for x in a])))
n = int(eval(input()))
a = list(map(int, input().split()))
dp = [[0 for _ in range(2)] for _ in range(n + 1)]
dp[0][1] = -(10**9)
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()))
cnt = sum([1 for i in a if i < 0])
if cnt % 2:
    r = 10**9
    for i in range(n):
        r = min(r, abs(a[i]))
    print((sum([abs(x) for x in a]) - 2 * r))
else:
    print((sum([abs(x) for x in a])))

-dp = [[0 for _ in range(2)] for _ in range(n + 1)] -dp[0][1] = -(10**9) -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])) +cnt = sum([1 for i in a if i < 0]) +if cnt % 2: +    r = 10**9 +    for i in range(n): +        r = min(r, abs(a[i])) +    print((sum([abs(x) for x in a]) - 2 * r)) +else: +    print((sum([abs(x) for x in a])))