n = int(eval(input()))

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



def solveDp():

    POS, NEG = 0, 1

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

    dp[NEG][0] = -float('inf')

    for i in range(n):

        dp[POS][i + 1] = max(dp[POS][i] + a[i], dp[NEG][i] - a[i])

        dp[NEG][i + 1] = max(dp[POS][i] - a[i], dp[NEG][i] + a[i])

    print((dp[POS][n]))



def solve():

    nNegative = 0

    total = 0

    minVal = float('inf')

    for num in a:

        if num < 0:

            num *= -1

            nNegative += 1

        minVal = min(minVal, num)

        total += num

    print((total if nNegative & 1 == 0 else total - 2 * minVal))



solveDp()
n = int(eval(input()))

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



negCnt = 0

absSum = 0

minAbs = float('inf')

for val in a:

    negCnt += val < 0

    absVal = abs(val)

    absSum += absVal

    minAbs = min(minAbs, absVal)

print((absSum - 2 * minAbs if negCnt & 1 else absSum))
n = int(eval(input()))
a = list(map(int, input().split()))


def solveDp():
    POS, NEG = 0, 1
    dp = [[0 for _ in range(n + 1)] for _ in range(2)]
    dp[NEG][0] = -float("inf")
    for i in range(n):
        dp[POS][i + 1] = max(dp[POS][i] + a[i], dp[NEG][i] - a[i])
        dp[NEG][i + 1] = max(dp[POS][i] - a[i], dp[NEG][i] + a[i])
    print((dp[POS][n]))


def solve():
    nNegative = 0
    total = 0
    minVal = float("inf")
    for num in a:
        if num < 0:
            num *= -1
            nNegative += 1
        minVal = min(minVal, num)
        total += num
    print((total if nNegative & 1 == 0 else total - 2 * minVal))


solveDp()

n = int(eval(input()))
a = list(map(int, input().split()))
negCnt = 0
absSum = 0
minAbs = float("inf")
for val in a:
    negCnt += val < 0
    absVal = abs(val)
    absSum += absVal
    minAbs = min(minAbs, absVal)
print((absSum - 2 * minAbs if negCnt & 1 else absSum))

- - -def solveDp(): -    POS, NEG = 0, 1 -    dp = [[0 for _ in range(n + 1)] for _ in range(2)] -    dp[NEG][0] = -float("inf") -    for i in range(n): -        dp[POS][i + 1] = max(dp[POS][i] + a[i], dp[NEG][i] - a[i]) -        dp[NEG][i + 1] = max(dp[POS][i] - a[i], dp[NEG][i] + a[i]) -    print((dp[POS][n])) - - -def solve(): -    nNegative = 0 -    total = 0 -    minVal = float("inf") -    for num in a: -        if num < 0: -            num *= -1 -            nNegative += 1 -        minVal = min(minVal, num) -        total += num -    print((total if nNegative & 1 == 0 else total - 2 * minVal)) - - -solveDp() +negCnt = 0 +absSum = 0 +minAbs = float("inf") +for val in a: +    negCnt += val < 0 +    absVal = abs(val) +    absSum += absVal +    minAbs = min(minAbs, absVal) +print((absSum - 2 * minAbs if negCnt & 1 else absSum))