Yaroslav has an array, consisting of (2·n - 1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exactly n array elements, and multiply each of them by -1.

Yaroslav is now wondering: what maximum sum of array elements can be obtained if it is allowed to perform any number of described operations?

Help Yaroslav.


-----Input-----

The first line contains an integer n (2 ≤ n ≤ 100). The second line contains (2·n - 1) integers — the array elements. The array elements do not exceed 1000 in their absolute value.


-----Output-----

In a single line print the answer to the problem — the maximum sum that Yaroslav can get.


-----Examples-----
Input
2
50 50 50

Output
150

Input
2
-1 -100 -1

Output
100



-----Note-----

In the first sample you do not need to change anything. The sum of elements equals 150.

In the second sample you need to change the sign of the first two elements. Then we get the sum of the elements equal to 100.

Difficulty: competition

Starter code:

Solutions:
n = int(input())
a = list(map(int, input().split()))

abs_a = [abs(v) for v in a]
neg = sum(v < 0 for v in a)
if n % 2 == 1 or neg % 2 == 0 or any(v == 0 for v in a):
    print(sum(abs_a))
else:
    print(sum(abs_a) - 2 * min(abs_a))


n = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
  if i < 0:
    b += 1
c = list(map(abs, a))
if b & 1 and n + 1 & 1:
  print(sum(c) - 2 * min(c))
else:
  print(sum(c))

n = int(input())
a = list(map(int, input().split()))
c = list(map(abs, a))
if len(list(filter(lambda x: x < 0, a))) & 1 and n + 1 & 1:
  print(sum(c) - 2 * min(c))
else:
  print(sum(c))

n, t = int(input()), list(map(int, input().split()))
p = list(map(abs, t))
s = sum(p)
if n & 1 == 0 and len([0 for i in t if i < 0]) & 1: s -= 2 * min(p)
print(s)

def numneg(arr):
    s = 0
    for x in arr:
        if x < 0:
            s += 1
    return s
def negmax(arr):
    maxi = float('inf')
    for x in arr:
        if abs(x) < maxi:
            maxi = abs(x)
    return -maxi
def sumabs(arr):
    s = 0
    for x in arr:
        s += abs(x)
    return s
n = int(input())
a = list(map(int, input().split()))
if numneg(a) % 2 == 0 or n % 2 == 1:
    print(sumabs(a))
else:
    print(sumabs(a) + negmax(a) * 2)


3

n = int(input())
data = list(map(int, input().split()))

negative, zero, positive = 0, 0, 0
for x in data:
    if x < 0:
        negative += 1
    elif x == 0:
        zero += 1
    else:
        positive += 1

seen = {}
min_negative = negative

def go(negative, positive):
    nonlocal n, min_negative
    if (negative, positive) in seen:
        return
    seen[(negative, positive)] = True
    min_negative = min(min_negative, negative)
    for i in range(min(n, negative)+1):
        for j in range(min(n-i, zero)+1):
            k = n - i - j
            if k <= positive:
                go(negative-i+k, positive-k+i)

go(negative, positive)

values = sorted(list(map(abs, data)))
for i in range(min_negative):
    values[i] *= -1

print(sum(values))



3

n = int(input())
data = list(map(int, input().split()))

x = 0
for element in data:
    if element < 0:
        x += 1

values = sorted(list(map(abs, data)))
result = sum(values)
if n % 2 == 0 and x % 2 == 1:
    result -= 2*values[0]

print(result)



def main():
	n = int(input())
	seq = list(map(int, input().split()))
	neg = [x for x in seq if x < 0]

	seq = [abs(x) for x in seq]
	ans = sum(seq)

	if n%2==0 and len(neg)%2==1:
		ans = ans - (2 * sorted(seq)[0])
	
	print(ans)


def __starting_point():
    main()
    

__starting_point()

def main():
    n = int(input())
    l = list(map(int, input().split()))
    res = sum(map(abs, l))
    if not n & 1 and sum(x < 0 for x in l) & 1:
        res -= abs(min(l, key=abs)) * 2
    print(res)


def __starting_point():
    main()

__starting_point()

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

neg = sum( A[ i ] < 0 for i in range( len( A ) ) )
if 0 in A or N % 2 == 1:
  neg = 0

B = sorted( [ abs( A[ i ] ) for i in range( len( A ) ) ] )
if neg & 1:
  print( - abs( B[ 0 ] ) + sum( B[ i ] for i in range( 1, len( B ), 1 ) ) )
else:
  print( sum( B[ i ] for i in range( len( B ) ) ) )


n = int(input())
a=[int(x) for x in input().split()]
count=0
for i in range(2*n-1):
    if (a[i]<0):
        count+=1
if (n%2==0 and count%2!=0):
    for i in range(2 * n - 1):
        if (a[i] < 0):
            a[i] = a[i]*(-1)
    a = sorted(a)
    a[0] = a[0]*(-1)
    print(sum(a))

else:
    for i in range(2*n-1):
        if (a[i]<0):
            a[i]=a[i]*(-1)
    print(sum(a))

n = int(input())

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

c = list(map(abs, a))

if len(list(filter(lambda x: x < 0, a))) & 1 and n + 1 & 1:

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

else:

  print(sum(c))

n = int(input())
lst = [int(x) for x in input().split()]
x = len([elem for elem in lst if elem < 0])
values = sorted([abs(elem) for elem in lst])
result = sum(values)
if n % 2 == 0 and x % 2 == 1:
    result -= 2 * values[0]
print(result)


n = int(input())
a = list(map(int,input().split()))
x = list(map(abs,a))
sm = sum(x)
# print(sm)
if n&1==0 and len([0 for i in a if i<0])&1==1:
    sm-=2*min(x)
print(sm)

n=int(input())
p=[int(x) for x in input().split()]
s=0
for i in p:
    if i<=0:
        s+=1
if n%2==0 and s%2!=0:
    q = 1000
    for i in p:
        if  abs(i) <= q:
            q = abs(i)
    print(sum(abs(i) for i in p) - 2 * q)

else:
        print(sum(abs(i) for i in p))









n = int(input())
a = sorted(map(int, input().split()))
b = map(lambda x: abs(x), a)
ans = sum(a)
for i in range(1, n+n-1, 2):
    a[i] *= -1
    a[i-1] *= -1
    ans = max(ans, sum(a))
if n % 2 == 1:
    ans = max(ans, sum(b))
print (ans)