n = int(eval(input()))

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



lb = [0]*(n+1)

lb_flip = [-100000000000000]*(n+1)



for i in range(n):

	lb[i+1] = max(lb[i]+la[i], lb_flip[i]-la[i])

	lb_flip[i+1] = max(lb[i]-la[i], lb_flip[i]+la[i])



#print(lb)

#print(lb_flip)



print((lb[n]))
n = int(eval(input()))

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



ct0 = 0

ctm = 0

minm = 100000000000000000

ans = 0



for i in range(n):

	if la[i] == 0:

		ct0 += 1

	elif la[i] < 0:

		ctm += 1

	

	m = abs(la[i])

	if m < minm:

		minm = m

	ans += m



if ct0 > 0 or ctm % 2 == 0:

	print(ans)

else:

	ans -= 2 * minm

	print(ans)
n = int(eval(input()))
la = list(map(int, input().split()))
lb = [0] * (n + 1)
lb_flip = [-100000000000000] * (n + 1)
for i in range(n):
    lb[i + 1] = max(lb[i] + la[i], lb_flip[i] - la[i])
    lb_flip[i + 1] = max(lb[i] - la[i], lb_flip[i] + la[i])
# print(lb)
# print(lb_flip)
print((lb[n]))

n = int(eval(input()))
la = list(map(int, input().split()))
ct0 = 0
ctm = 0
minm = 100000000000000000
ans = 0
for i in range(n):
    if la[i] == 0:
        ct0 += 1
    elif la[i] < 0:
        ctm += 1
    m = abs(la[i])
    if m < minm:
        minm = m
    ans += m
if ct0 > 0 or ctm % 2 == 0:
    print(ans)
else:
    ans -= 2 * minm
    print(ans)

-lb = [0] * (n + 1) -lb_flip = [-100000000000000] * (n + 1) +ct0 = 0 +ctm = 0 +minm = 100000000000000000 +ans = 0 -    lb[i + 1] = max(lb[i] + la[i], lb_flip[i] - la[i]) -    lb_flip[i + 1] = max(lb[i] - la[i], lb_flip[i] + la[i]) -# print(lb) -# print(lb_flip) -print((lb[n])) +    if la[i] == 0: +        ct0 += 1 +    elif la[i] < 0: +        ctm += 1 +    m = abs(la[i]) +    if m < minm: +        minm = m +    ans += m +if ct0 > 0 or ctm % 2 == 0: +    print(ans) +else: +    ans -= 2 * minm +    print(ans)