You are given a sequence a consisting of n integers. You may partition this sequence into two sequences b and c in such a way that every element belongs exactly to one of these sequences. 

Let B be the sum of elements belonging to b, and C be the sum of elements belonging to c (if some of these sequences is empty, then its sum is 0). What is the maximum possible value of B - C?


-----Input-----

The first line contains one integer n (1 ≤ n ≤ 100) — the number of elements in a.

The second line contains n integers a_1, a_2, ..., a_{n} ( - 100 ≤ a_{i} ≤ 100) — the elements of sequence a.


-----Output-----

Print the maximum possible value of B - C, where B is the sum of elements of sequence b, and C is the sum of elements of sequence c.


-----Examples-----
Input
3
1 -2 0

Output
3

Input
6
16 23 16 15 42 8

Output
120



-----Note-----

In the first example we may choose b = {1, 0}, c = { - 2}. Then B = 1, C =  - 2, B - C = 3.

In the second example we choose b = {16, 23, 16, 15, 42, 8}, c = {} (an empty sequence). Then B = 120, C = 0, B - C = 120.

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
def main_function():
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	sum_positive = 0
	sum_negative = 0
	for i in a:
		if i > 0:
			sum_positive += i
		else:
			sum_negative += i
	return sum_positive - sum_negative
print(main_function())


n = int(input())
l = list(map(int, input().split()))
b = []
c = []
for i in l:
	if i > 0:
		b.append(i)
	else:
		c.append(i)
if len(c) > 0:
	print(sum(b) - sum(c))
else:
	print(sum(b))


n = int(input())
a_str = input()
a = a_str.split(' ')
b = []
c = []
for num in a:
	if int(num) > 0:
		b.append(int(num))
	else:
		c.append(int(num))
sum_b = sum(b)
sum_c = sum(c)
print(sum_b - sum_c)


n = int(input())
l = list(map(int, input().split()))
x = 0
y = 0
for i in l:
	if i >= 0:
		x += i
	else:
		y += i
res = x - y
print(res)


n = int(input())
a = list(map(int, input().split()))
pol = []
otr = []
for i in range(n):
	if a[i] >= 0:
		pol.append(a[i])
	else:
		otr.append(a[i])
print(sum(pol) - sum(otr))


n = int(input())
x = list(map(int, input().split()))
x.sort()
y = list(filter(lambda x: x > 0, x))
z = list(filter(lambda x: x < 0, x))
print(sum(y) - sum(z))


n = int(input())
a = list(map(int, input().split()))
b = []
c = []
sum1 = 0
sum2 = 0
for i in a:
	if i >= 0:
		sum1 += i
	else:
		sum2 += i
print(sum1 - sum2)


n = int(input())
s1 = 0
s2 = 0
s = [int(x) for x in input().split()]
for i in range(n):
	if s[i] >= 0:
		s1 += s[i]
	else:
		s2 += s[i]
print(s1 - s2)


n = int(input())
arr = input().split()
b = []
c = []
for i in arr:
	if int(i) >= 0:
		b.append(int(i))
	else:
		c.append(int(i))
print(sum(b) - sum(c))


n = int(input())
a = list(map(int, input().split()))
s1 = 0
s2 = 0
for i in a:
	if i > 0:
		s1 += i
	else:
		s2 += i
print(s1 - s2)


input()
print(sum(list(map(abs, map(int, input().split())))))


n = int(input())
k = input().split()
sum = 0
for p in k:
	if int(p) >= 0:
		sum += int(p)
	else:
		sum -= int(p)
print(sum)


n = int(input())
f = 0
a = list(map(int, input().split()))
l = []
for i in range(n):
	if a[i] < 0:
		l.append(a[i])
print(sum(a) - 2 * sum(l))


def partition(array):
	max_b_minus_c = 0
	for num in array:
		max_b_minus_c += abs(num)
	return max_b_minus_c
n = int(input())
array = list(map(int, input().split()))
print(partition(array))


def answer():
	n = int(input())
	a = [int(x) for x in input().split()]
	b = [x for x in a if x < 0]
	c = [x for x in a if x > 0]
	print(abs(sum(b)) + sum(c))
answer()


n = int(input())
l = list(map(int, input().split()))
s = 0
for i in l:
	s += abs(i)
print(s)


n = int(input())
A = input().split()
(B, C) = ([], [])
for i in range(n):
	A[i] = int(A[i])
	if A[i] > 0:
		B.append(A[i])
	else:
		C.append(A[i])
print(sum(B) - sum(C))


n = int(input())
mas = [int(i) for i in input().split()]
(B, C) = (0, 0)
if min(mas) < 0:
	for i in mas:
		if i > 0:
			B += i
		else:
			C += i
else:
	for i in mas:
		B += i
print(B - C)


n = int(input())
numbers = list(map(int, input().strip().split()))
print(sum([abs(x) for x in numbers]))


n = int(input())
a = [0]
b = [0]
for i in input().split():
	if int(i) > 0:
		a.append(int(i))
	else:
		b.append(int(i))
print(sum(a) - sum(b))


n = int(input())
a = input().split()
a = list(map(int, a))
b = []
c = []
for num in a:
	if num >= 0:
		b.append(num)
	else:
		c.append(num)
if len(b) == 0:
	b.append(0)
if len(c) == 0:
	c.append(0)
B = sum(b)
C = sum(c)
print(B - C)


n = int(input())
b = []
c = []
arr = list(map(int, input().split()))
for i in range(n):
	if arr[i] >= 0:
		b.append(arr[i])
	else:
		c.append(arr[i])
print(sum(b) - sum(c))


n = int(input())
nums = [int(x) for x in input().split()]
a = sum([x for x in nums if x > 0])
b = sum([x for x in nums if x < 0])
print(a - b)


n = int(input())
a = list(map(int, input().split(' ')))
sumv = 0
for i in range(n):
	if a[i] < 0:
		sumv -= a[i]
	else:
		sumv += a[i]
print(sumv)


n = int(input())
ar = [int(x) for x in input().split()]
ar.sort()
minus = 0
pos = 0
for i in range(n):
	if ar[i] < 0:
		minus = minus + ar[i]
	else:
		pos = pos + ar[i]
result = pos - minus
print(result)


n = int(input())
a = list(map(int, input().split()))
a1 = 0
a2 = 0
for i in a:
	if i >= 0:
		a1 += i
	else:
		a2 += i
print(abs(a1 - a2))


n = int(input())
a = list(map(int, input().split()))
B = sum(filter(lambda x: x > 0, a))
C = sum(filter(lambda x: x < 0, a))
print(B - C)


n = int(input())
l = list(map(int, input().split()))
sum = 0
for i in range(n):
	if l[i] < 0:
		l[i] = abs(l[i])
	sum = sum + l[i]
print(sum)


input()
a = list(map(int, input().split()))
print(sum(list((i for i in a if i >= 0))) - sum(list((i for i in a if i < 0))))


n = int(input())
a = (int(x) for x in input().split())
print(sum(map(abs, a)))


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
n = int(input())
a = list(map(int, input().split()))
ans = 0
for ai in a:
	ans += abs(ai)
print(ans)


n = int(input())
string = input().split(' ')
total = 0
for num in string:
	total += abs(int(num))
print(total)


n = int(input())
a = list(map(int, input().split()))
b = c = 0
for i in range(n):
	if a[i] > 0:
		b += a[i]
	else:
		c += a[i]
d = b - c
print(d)


(b, c) = ([], [])
a = int(input())
A = list(map(int, input().split()))
for x in range(a):
	if A[x] <= 0:
		c.append(A[x])
	else:
		b.append(A[x])
print(sum(b) - sum(c))


orz = int(input())
a = [abs(i) for i in list(map(int, input().split()))]
print(sum(a))


n = int(input())
n1 = list(map(int, input().split()))
lst = []
lst1 = []
for i in range(n):
	if n1[i] < 0:
		lst.append(n1[i])
	else:
		lst1.append(n1[i])
print(sum(lst1) - sum(lst))


arraySize = int(input())
array = list(map(int, input().split()))
first = 0
second = 0
for i in array:
	if i < 0:
		second += i
	else:
		first += i
print(first - second)


n = int(input())
a = list(map(int, input().split()))
p = 0
z = 0
for i in a:
	if i > 0:
		p = p + i
	else:
		z = z + i
print(p - z)


n = int(input())
l = list(map(int, input().split()))
(x, x1) = ([], [])
for i in range(n):
	if l[i] >= 0:
		x.append(l[i])
	else:
		x1.append(abs(l[i]))
print(sum(x) + sum(x1))


n = int(input())
A = list(map(int, input().split()))
B = 0
C = 0
for i in range(0, n):
	if A[i] < 0:
		C += A[i]
	elif A[i] >= 0:
		B += A[i]
print(B - C)


n = int(input())
print(sum(sorted(list(map(lambda x: abs(int(x)), input().split())))))


n = int(input())
a = []
b = []
num = []
str_in = input()
num = [int(n) for n in str_in.split()]
for x in num:
	if x >= 0:
		a.append(x)
	elif x < 0:
		b.append(x)
total_a = 0
total_b = 0
for x in a:
	total_a = x + total_a
for x in b:
	total_b = x + total_b
print(total_a - total_b)


n = int(input())
print(sum(map(abs, map(int, input().split()))))


t = int(input())
fullseq = map(int, input().split())
sumOf = sum(map(abs, fullseq))
print(sumOf)


n = int(input())
data = list(map(int, input().split()))
data.sort()
i = 0
while i < n and data[i] < 0:
	i += 1
print(sum(data[i:]) - sum(data[:i]))


t = int(input())
l = list(map(int, input().split()))
x = []
y = []
for i in l:
	if i >= 0:
		x.append(i)
	else:
		y.append(i)
sum1 = sum(x)
sum2 = sum(y)
print(sum1 - sum2)


input()
a = list(map(int, input().split()))
a.sort()
b = []
c = []
for i in a:
	if i <= 0:
		c.append(i)
	else:
		b.append(i)
print(sum(b) - sum(c))


n = int(input())
l = [int(i) for i in input().split(' ')]
(a1, a2) = (0, 0)
for i in l:
	if i < 0:
		a1 += -i
	else:
		a1 += i
print(a1 + a2)


input()
k = map(int, input().split())
B = []
C = []
for item in k:
	if item < 0:
		C.append(item)
	else:
		B.append(item)
print(sum(B) - sum(C))


n = int(input())
x = input()
xx = x.split()
B = []
C = []
for i in xx:
	if int(i) < 0:
		C.append(int(i))
	else:
		B.append(int(i))
b = 0
c = 0
for i in B:
	b += i
for i in C:
	c += i
print(b - c)


input()
x = [*map(int, input().split())]
total_sum = sum(x)
max_partial_sum = 0
for i in x:
	if i > 0:
		max_partial_sum += i
print(max_partial_sum - (total_sum - max_partial_sum))


n = int(input())
b = list(map(int, input().split()))
ans = 0
for e in b:
	ans += abs(e)
print(ans)


n = int(input())
print(sum(map(lambda x: abs(int(x)), input().split())))


n = int(input())
print(sum([abs(int(x)) for x in input().split()]))


n = int(input())
a = list(map(int, input().split()))
sum = 0
for i in a:
	sum = sum + abs(i)
print(sum)


n = int(input())
a = list(map(int, input().split()))
pos = [x for x in a if x >= 0]
neg = [x for x in a if x < 0]
print(sum(pos) - sum(neg))


n = int(input())
s = map(int, input().split())
res = 0
b = 0
c = 0
for i in s:
	if i < 0:
		b -= i
	else:
		c += i
print(b + c)


n = int(input())
elements = list(map(int, input().split()))
b = []
c = []
for i in elements:
	if i > 0:
		b.append(i)
	else:
		c.append(i)
B = 0
C = 0
try:
	for x in b:
		B += x
	for y in c:
		C += y
except:
	pass
print(B - C)


n = int(input())
a = list(map(int, input().split()))
(b, c) = ([], [])
a.sort(reverse=True)
for i in range(n):
	if a[i] < 0:
		c.append(a[i])
	else:
		b.append(a[i])
print(sum(b) - sum(c))


n = int(input())
line = input().split(' ')
sum1 = 0
sum2 = 0
for i in range(n):
	if int(line[i]) > 0:
		sum1 = sum1 + int(line[i])
	else:
		sum2 = sum2 + int(line[i])
print(sum1 - sum2)


input()
a = [int(x) for x in input().split()]
a.sort()
(b, c) = ([], [])
for i in range(len(a)):
	if a[i] < 0:
		b.append(a[i])
	else:
		c.append(a[i])
print(abs(sum(c) - sum(b)))


n = int(input())
a = list(map(abs, map(int, input().split())))
print(sum(a))


x = int(input())
l = list(map(int, input().split()))
p = []
n = []
for i in l:
	if i > 0:
		p = p + [i]
	elif i < 0:
		n = n + [i]
print(sum(p) - sum(n))


(z, zz, dgraphs, mod) = (input, lambda : list(map(int, z().split())), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
z()
l = sorted(zz())
t = 0
c = 0
f = 0
for i in l:
	if i <= 0:
		c = 1
		t += i
	else:
		f += i
if c == 1:
	print(f - t)
else:
	print(f)


a = int(input())
b = input().split()
total = 0
for i in b:
	total += abs(int(i))
print(total)


n = int(input())
val = {'b': 0, 'c': 0}
l = list(map(int, input().split()))
for i in l:
	if i >= 0:
		val['b'] += i
	else:
		val['c'] += i
print(val['b'] - val['c'])


x = int(input())
y = sorted([int(_) for _ in input().split()])
(b, c) = (0, 0)
for i in y:
	if i < 0:
		c += i
	else:
		b += i
print(b - c)


n = int(input())
l = list(map(int, input().split()))
l = [abs(x) for x in l]
print(sum(l))


v = int(input())
l1 = []
l2 = []
l = [int(i) for i in input().split()]
for i in l:
	if i > 0:
		l1.append(i)
	else:
		l2.append(i)
a = sum(l1)
b = sum(l2)
if a - b > b - a:
	print(a - b)
else:
	print(b - a)


def read():
	return [int(v) for v in input().split()]

def main():
	read()
	a = read()
	s1 = sum(a)
	s2 = -sum(filter(lambda x: x < 0, a))
	print(s1 + 2 * s2)
main()


input()
a = map(int, input().split(' '))
print(sum(map(abs, a)))


n = int(input())
nums = list(map(int, input().strip().split(' ')))
ans = 0
for num in nums:
	if num < 0:
		ans -= num
	else:
		ans += num
print(ans)


(n, s) = (int(input()), 0)
A = list(map(int, input().split()))
for i in range(n):
	if A[i] > 0:
		s += A[i]
	else:
		s -= A[i]
print(s)


import sys
from math import *
from fractions import gcd
readints = lambda : map(int, input().strip('\n').split())
n = int(input())
a = list(readints())
ans = 0
for x in a:
	if x >= 0:
		ans += x
	else:
		ans -= x
print(ans)


n = int(input())
L = [int(k) for k in input().split()]
pos = 0
neg = 0
for k in L:
	if k > 0:
		pos += k
	else:
		neg += -k
print(pos + neg)


a = int(input())
b = 0
c = 0
e = input()
d = e.split(' ')
for i in range(a):
	if int(d[i]) >= 0:
		b = b + int(d[i])
	else:
		c = c + int(d[i])
print(b - c)


x = input()
print(sum(map(abs, map(int, input().split()))))


def main():
	n = int(input())
	arr = list(map(lambda x: int(x), input().split()))
	arr.sort(key=lambda x: -x)
	arr.append(0)
	for i in range(len(arr)):
		if arr[i] < 0:
			print(sum(arr[:i]) - sum(arr[i:]))
			return
	print(sum(arr))
main()


def asdf(arr, n):
	B = 0
	C = 0
	for i in range(n):
		if arr[i] > 0:
			B = B + arr[i]
		else:
			C = C + arr[i]
	print(B - C)
n = int(input())
arr = list(map(int, input().strip().split()))[:n]
asdf(arr, n)


n = int(input())
seq = list(map(int, input().split()))
sum = 0
for _ in range(n):
	seq[_] = abs(seq[_])
	sum += seq[_]
print(sum)


a = int(input())
b = input().split()
B = []
C = []
for q in b:
	q = int(q)
	if q > 0:
		B.append(q)
	else:
		C.append(q)
print(sum(B) - sum(C))


t = int(input())
m = list(map(int, input().split()))
sump = []
sumq = []
for i in range(t):
	if m[i] < 0:
		sump.append(m[i])
	else:
		sumq.append(m[i])
print(sum(sumq) - sum(sump))


n = int(input())
a = [int(i) for i in input().split()]
res = 0
for i in a:
	res += abs(i)
print(res)


a = int(input())
print(sum(map(lambda x: abs(int(x)), input().split())))


n = int(input())
vetor = list(map(int, input().split()))
vetor_positivo = list(filter(lambda x: x >= 0, vetor))
vetor_negativo = list(filter(lambda x: x < 0, vetor))
soma_positiva = sum(vetor_positivo)
soma_negativa = sum(vetor_negativo)
print(soma_positiva - soma_negativa)


n = int(input())
a = map(int, input().split())
s1 = 0
for i in a:
	s1 += abs(i)
print(s1)


a = int(input())
c = list(map(int, input().split()))
x = 0
for i in c:
	if i < 0:
		x += abs(i)
	else:
		x += i
print(x)


import math
from sys import stdin
n = int(stdin.readline())
string = stdin.readline().strip().split()
b = []
c = []
for x in string:
	if int(x) >= 0:
		b.append(int(x))
	else:
		c.append(int(x))
print(sum(b) - sum(c))


import sys
n = int(input())
a = list(map(int, input().split()))
(plus, minus) = (0, 0)
for x in a:
	if x >= 0:
		plus += x
	else:
		minus -= x
print(plus + minus)


input()
x = input().split()
y = z = 0
for i in x:
	if int(i) < 0:
		y += int(i)
	else:
		z += int(i)
print(int(z) - int(y))


x = int(input())
arr = list(map(int, input().split()))
a = []
b = []
for i in arr:
	if i < 0:
		a.append(i)
	else:
		b.append(i)
sumA = sum(a)
sumB = sum(b)
print(sumB - sumA)


_ = int(input())
a = list(map(int, input().split()))
print(sum((max(0, i) for i in a)) - sum((min(0, i) for i in a)))


n = int(input())
a = [int(v) for v in input().split()]
print(sum((abs(v) for v in a)))


n = int(input())
ls = list(map(int, input().split()))
neg = 0
pos = 0
for i in ls:
	if i < 0:
		neg += i
	else:
		pos += i
print(pos - neg)


def main():
	N = int(input())
	A = tuple(map(int, input().split()))
	a = sorted(A)
	if a[0] < 0 and a[-1] < 0:
		ans = 0 - sum(a)
	elif a[0] < 0:
		b = [i for i in a if i >= 0]
		c = [i for i in a if i < 0]
		ans = sum(b) - sum(c)
	else:
		ans = sum(a)
	print(ans)
main()


n = int(input())
m = list(map(int, input().split()))
a = 0
b = 0
for i in m:
	if i >= 0:
		a += i
	else:
		b += i
print(a - b)


n = int(input())
x = input().split()
x = [int(k) for k in x]
S = 0
for k in x:
	S += abs(k)
print(S)


a = input()
k = 0
b = list(map(int, input().split()))
for item in b:
	k += abs(item)
print(k)


n = input()
arr = [int(i) for i in input().split()]
(positive, negative) = (0, 0)
for val in arr:
	if val < 0:
		negative += val
	if val > 0:
		positive += val
print(positive - negative)


import sys
n = map(int, sys.stdin.readline().split())
numbers = list(map(int, sys.stdin.readline().split()))
total = 0
for i in numbers:
	total += i if i >= 0 else -i
print(total)


n = int(input())
l = list(map(int, input().split()))
sum = 0
for x in l:
	if x >= 0:
		sum = sum + x
	else:
		sum = sum - x
print(sum)


n = int(input())
a = list(map(int, input().split()))
suma = 0
for i in a:
	if i >= 0:
		suma += i
	else:
		suma -= i
print(suma)


n = int(input())
v = [int(x) for x in input().split()]
ans = 0
for x in v:
	ans += x if x > 0 else -x
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
(b, c) = (0, 0)
for i in a:
	if i < 0:
		c += i
	else:
		b += i
print(b - c)


import sys
n = int(input())
L = list(input().split())
sum = 0
for x in L:
	sum += abs(int(x))
print(sum)


def razdelenie(lst):
	(count1, count2) = (0, 0)
	for elem in lst:
		if elem > 0:
			count1 += elem
		else:
			count2 += elem
	return count1 - count2
n = int(input())
a = [int(i) for i in input().split()]
print(razdelenie(a))


n = int(input())
values = input().split()
b = list()
c = list()
for each in values:
	if int(each) > 0:
		b.append(int(each))
	else:
		c.append(int(each))
print(max(sum(b), sum(c), sum(b) - sum(c)))


def F(A):
	B = [a for a in A if a >= 0]
	C = [a for a in A if a < 0]
	return sum(B) - sum(C)
n = int(input())
print(F([int(a) for a in input().split()]))


n = int(input())
a = list(map(int, input().split()))
a.sort()
o = 0
for i in range(n):
	if a[i] < 0:
		o -= a[i]
	else:
		o += a[i]
print(o)


n = int(input())
a = [int(num) for num in input().split()]
pos = 0
neg = 0
for i in a:
	if i > 0:
		pos = pos + i
	else:
		neg = neg + i
print(pos - neg)


valor = input()
lista = [int(x) for x in input().split()]
a = []
b = []
for x in range(len(lista)):
	if lista[x] >= 0:
		a.append(lista[x])
	if lista[x] < 0:
		b.append(lista[x])
print(sum(a) - sum(b))


n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	a[i] = abs(a[i])
print(sum(a))


a = int(input())
b = list()
c = list()
d = list(map(int, input().split()))
for i in d:
	if i >= 0:
		b.append(i)
	else:
		c.append(i)
sb = 0
sc = 0
for i in b:
	sb = sb + i
for i in c:
	sc = sc + i
print(sb - sc)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
array = get_list()[::-1]
l = []
r = []
for i in array:
	if i > 0:
		l.append(i)
	else:
		r.append(i)
print(sum(l) - sum(r))


size = input()
n = [int(x) for x in input().split()]
b = []
c = []
for i in n:
	if i < 0:
		c.append(i)
	elif i >= 0:
		b.append(i)
t = sum(b) + abs(sum(c))
print(t)


n = int(input())
a = [int(x) for x in input().split(' ')]
ma = sum([x for x in a if x >= 0])
mi = sum([x for x in a if x < 0])
print(ma - mi)


a = int(input())
b = input().split()
r = len(b)
i = 0
lst1 = []
lst2 = []
j = 0
k = 0
l = 0
m = 0
if r == a:
	for i in range(r):
		v = int(b[i])
		if v >= 0:
			lst1.append(v)
		else:
			lst2.append(v)
x = len(lst1)
y = len(lst2)
for j in range(x):
	c = lst1[j]
	l = l + c
for k in range(y):
	d = lst2[k]
	m = m + d
if x > 0 and y > 0:
	z = l - m
elif x > 0 and y == 0:
	z = l
elif x == 0 and y > 0:
	z = 0 - m
elif x == 0 and y == 0:
	z = 0
print(z)


input()
l = list(map(int, input().split()))
(p, c) = (0, 0)
for i in l:
	if i < 0:
		c += i
	else:
		p += i
print(abs(c - p))


n = int(input())
line = input()
arr = [int(x) for x in line.split()]
list1 = []
list2 = []
for i in arr:
	if i >= 0:
		list1.append(i)
	else:
		list2.append(i)
print(sum(list1) - sum(list2))


T = int(input())
seq = list(map(int, input().split()))
B = 0
C = 0
for i in range(T):
	if seq[i] > 0:
		B += seq[i]
	else:
		C += seq[i]
print(B - C)


n = int(input())
a = list(map(int, input().split()))
s = 0
ss = 0
for i in a:
	if i < 0:
		ss += i
	else:
		s += i
print(abs(s - ss))


n = int(input())
m = list(map(int, input().split()))
print(sum((i for i in m if i > 0)) - sum((i for i in m if i < 0)))


n = int(input())
l = sorted(list(map(int, input().split())))
i = 0
s = 0
while i < n and l[i] < 0:
	s += l[i]
	i += 1
print(abs(s) + sum(l[i:]))


n = int(input())
s1 = 0
s2 = 0
l = list(map(int, input().split()))
for i in range(n):
	if l[i] >= 0:
		s1 += l[i]
	else:
		s2 += l[i]
print(s1 - s2)


def main():
	input()
	a = [int(i) for i in input().split()]
	b = []
	c = []
	while a:
		i = a.pop()
		if i > 0:
			b.append(i)
		else:
			c.append(i)
	print(sum(b) - sum(c))
main()


input()
print(sum([abs(int(v)) for v in input().split()]))


n = int(input())
lst = []
for x in input().split():
	lst.append(int(x))
sum_1 = 0
sum_2 = 0
for x in lst:
	if x >= 0:
		sum_1 += x
	else:
		sum_2 += x
print(sum_1 - sum_2)


n = int(input())
a = []
b = []
num = []
strr = input()
num = [int(n) for n in strr.split()]
for i in num:
	if i >= 0:
		a.append(i)
	elif i < 0:
		b.append(i)
suma = 0
sumb = 0
for i in a:
	suma = i + suma
for i in b:
	sumb = i + sumb
print(suma - sumb)


aSeqLen = input()
aSeq = input()
a = aSeq.split(' ')
sum = 0
for i in a:
	if int(i) > 0:
		sum += int(i)
	else:
		sum += abs(int(i))
print(sum)


import sys

def cal(arr, n):
	b = [0]
	c = [0]
	for x in arr:
		if x >= 0:
			b.append(x)
		elif x < 0:
			c.append(x)
	B = 0
	C = 0
	for x in b:
		B = B + x
	for x in c:
		C = C + x
	return B - C

def main():
	n = int(input())
	if n == 0:
		print(0)
		return
	s = input()
	s = s.split()
	arr = list(map(int, s))
	print(cal(arr, n))
	return
main()


n = int(input())
a = sorted(list(map(int, input().split())))
c = []
d = []
for i in range(len(a)):
	if a[i] >= 0:
		c.append(a[i])
	else:
		d.append(a[i])
print(sum(c) - sum(d))


n = int(input())
A = list(map(int, input().split()))
(a, b) = ([0] * n, [0] * n)
for i in range(len(A)):
	if A[i] > 0:
		a[i] = A[i]
	else:
		b[i] = A[i]
(sum1, sum2) = (sum(a), sum(b))
print(sum1 - sum2)


def code1(n, a):
	s = 0
	for i in a:
		if i < 0:
			s += i
	return sum(a) - 2 * s
n = int(input())
a = [int(i) for i in input().split()]
print(code1(n, a))


n = int(input())
arr = list(map(int, input().split()))
result = 0
for i in arr:
	if i > 0:
		result += i
	else:
		result -= i
print(result)


n = int(input())
x = y = p = int(0)
arr = list(map(int, input().split()))
if n == len(arr):
	p = 1
	for j in arr:
		if j <= 0:
			y = y + j
		else:
			x = x + j
if p == 1:
	print(x - y)


n = int(input())
lst = [*map(int, input().split())]
for i in range(n):
	if lst[i] <= 0:
		lst[i] = lst[i] * -1
print(sum(lst))


a = int(input())
b = list(map(int, input().split()))
p = int(0)
for x in b:
	p = p + abs(x)
print(p)


R = lambda : map(int, input().split())
n = int(input())
a = list(R())
s = 0
for i in range(n):
	if a[i] >= 0:
		s += a[i]
	else:
		s -= a[i]
print(s)


n = int(input())
a = list(map(int, input().split()))
ans0 = 0
ans2 = 0
for i in range(n):
	if a[i] > 0:
		ans0 += a[i]
	else:
		ans2 += a[i]
print(ans0 - ans2)


n = int(input())
lst = [int(x) for x in input().split()]
b = 0
c = 0
for i in range(n):
	if lst[i] >= 0:
		b += lst[i]
	else:
		c += lst[i]
print(b - c)


n = int(input())
(first, second) = ([], [])
integer = list(map(int, input().split()))
for i in integer:
	if i >= 0:
		first.append(i)
	else:
		second.append(i)
k = sum(first)
q = sum(second)
print(k - q)


size = int(input())
arr = list(map(int, input().split(' ')))
min_sum = sum([i for i in arr if i < 0])
max_sum = sum([i for i in arr if i >= 0])
print(max_sum - min_sum)


k = int(input())
ans = 0
p = [int(i) for i in input().split()]
for j in p:
	ans += abs(j)
print(ans)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	sm = 0
	sn = 0
	for x in range(n):
		if a[x] >= 0:
			sm = sm + a[x]
		else:
			sn = sn + a[x]
	print(sm - sn)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


i = input
i()
a = [int(x) for x in i().split()]
print(2 * sum((x for x in a if x > 0)) - sum(a))


n = int(input())
t = list(map(int, input().split()))
(p, e) = (0, 0)
for i in range(len(t)):
	if t[i] < 0:
		p += t[i]
	else:
		e += t[i]
print(e - p)


n = int(input(''))
aux = str(input(''))
lista = aux.split(' ')
negativos = []
positivos = []
for i in range(len(lista)):
	if int(lista[i]) < 0:
		negativos.append(int(lista[i]))
	else:
		positivos.append(int(lista[i]))
print(sum(positivos) - sum(negativos))


import math
input()
print(sum(map(lambda x: x if x > 0 else -x, map(int, input().split()))))


def read():
	return list(map(int, input().split()))
n = int(input())
a = read()
B = 0
C = 0
for i in a:
	if i > 0:
		B += i
	else:
		C += i
print(B - C)


from functools import reduce
input()
print(reduce(lambda x, y: x + y, map(lambda x: abs(int(x)), input().split())))


a = eval(input())
b = input().split()
b = [int(x) for x in b]
sum = 0
for i in b:
	sum += abs(i)
print(sum)


def solve(n, a):
	return sum([abs(i) for i in a])

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))
main()


n = int(input())
li = input()
ai = li.strip().split()
somme = 0
for i in ai:
	if int(i) >= 0:
		somme += int(i)
	else:
		somme -= int(i)
print(somme)


n = int(input())
a = input().split()
p = 0
for i in range(n):
	p += abs(int(a[i]))
print(p)


am = int(input())
arr = list(map(int, input().split()))
d = 0
for i in range(am):
	d += abs(arr[i])
print(d)


(n, r) = (input(), [0, 0])
for i in list(map(int, input().split())):
	r[i < 0] += i
print(r[0] - r[1])


n = int(input())
a = [int(q) for q in input().strip().split()]
a.sort()
t = 0
s = 0
for k in range(n):
	if a[k] < 0:
		t += a[k]
	else:
		s += a[k]
print(s - t)


a = int(input())
b = [*map(int, input().split())]
c = [abs(i) for i in b]
print(sum(c))


n = int(input())
a = list(map(int, input().split()))
cnt = 0
lnt = 0
for i in range(n):
	if a[i] > 0:
		cnt += a[i]
	else:
		lnt += a[i]
print(cnt - lnt)


n = int(input())
k = input().split()
k = list(map(int, k))
B = []
C = []
for i in range(n):
	if k[i] >= 0:
		B.append(k[i])
	else:
		C.append(k[i])
print(sum(B) - sum(C))


n = int(input())
a = list(map(int, input().strip().split()))
res = 0
for e in a:
	res += abs(e)
print(res)


n = map(int, input().rsplit())
a = list(map(int, input().split()))
i = 0
b = []
c = []
sum = 0
a.sort()
for i in range(0, len(a)):
	if a[i] > 0:
		sum += a[i]
	else:
		sum -= a[i]
print(sum)


sum = 0
zero = 0
n = int(input())
a = input().split()
a = list(map(int, a))
for i in range(0, n):
	if a[i] < 0:
		sum = sum - a[i]
	else:
		sum = sum + a[i]
print(sum)


noe = int(input())
ans = sum([abs(int(x)) for x in input().split()])
print(ans)


from math import *
n = int(input())
li = list(map(int, input().split()))
s = 0
for i in li:
	s += abs(i)
print(s)


n = int(input())
seq = list(map(int, input().split(' ')))
tot = 0
for x in seq:
	if x < 0:
		tot += -x
	else:
		tot += x
print(tot)


def get(x):
	return abs(int(x))
n = int(input())
a = list(map(get, input().split()))
print(sum(a))


from functools import reduce
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print(abs(a[0]))
else:
	print(reduce(lambda x, y: abs(x) + abs(y), a))


n = int(input())
ls = []
s = 0
for i in input().split():
	ls.append(int(i))
for i in range(ls.__len__()):
	if ls[i] < 0:
		ls[i] *= -1
	s += ls[i]
print(s)


n = int(input())
print(sum((abs(int(i)) for i in input().split())))


n = int(input())
a = list(map(int, input().split()))
b = [i for i in a if i > 0]
c = [i for i in a if i <= 0]
sb = 0
sc = 0
if len(b) > 0:
	sb = sum(b)
if len(c) > 0:
	sc = sum(c)
print(sb - sc)


b = []
c = []
n = int(input())
a = input().split()
for el in a:
	el = int(el)
	if el > 0:
		b.append(el)
	else:
		c.append(el)
print(sum(b) - sum(c))


from functools import reduce
num = int(input())
a = [int(a) for a in input().split()]
B = 0
C = 0
for i in a:
	if i >= 0:
		B = B + i
	else:
		C = C + i
print(int(B - C))


n = int(input())
s = list(map(int, input().split()))
pos = sum(filter(lambda x: x > 0, s))
neg = sum(filter(lambda x: x < 0, s))
print(pos - neg)


n = input()
l = list(map(int, input().split()))
sm = 0
for i in l:
	if i >= 0:
		sm += i
	else:
		sm += i * -1
print(sm)


exec('f=lambda x:abs(int(x));input();print(sum(map(f,input().split())))')


n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 0
for j in range(len(a) + 1):
	if j == len(a):
		break
	i = a[j]
	if i < 0:
		res += i
	else:
		break
print(sum(a[j:]) - res)


n = input()
t = list(map(int, input().split()))
count = 0
for i in t:
	if i > 0:
		count += i
	elif i < 0:
		count -= i
print(count)


_ = input()
total = 0
for i in map(int, input().split()):
	if i > 0:
		total += i
	else:
		total -= i
print(total)


import sys, math
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
n = int(input())
l = L()
b = 0
c = 0
for i in l:
	if i >= 0:
		b += i
	else:
		c += i
print(b - c)


po = int(input())
n = list(map(int, input().split()))
la = []
for item in n:
	la.append(abs(item))
print(sum(la))


x = int(input())
b = 0
c = 0
y = list(map(str, input().split()[:x]))
for n in range(len(y)):
	if int(y[n]) >= 0:
		b = b + int(y[n])
	elif int(y[n]) < 0:
		c = c + int(y[n])
print(b - c)


n = int(input())
a = list(map(int, input().split()))
sum = 0
sub = 0
for i in a:
	if i < 0:
		sub += i
	else:
		sum += i
result = sum - sub
print(result)


IL = lambda : list(map(int, input().split()))
I = lambda : int(input())
n = I()
a = IL()
print(sum(map(abs, a)))


n = int(input())
l = [int(i) for i in input().split()]
if sum((i < 0 for i in l)) == 0:
	print(sum(l))
else:
	z = [i for i in l if i > 0]
	z1 = [i for i in l if i < 0]
	print(sum(z) - sum(z1))


a = []
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
place = 0
if a[n - 1] < 0:
	print(-1 * sum(a))
elif a[0] >= 0:
	print(sum(a))
else:
	for i in range(n):
		if a[i] >= 0:
			place = i
			break
	print(sum(a[place:]) - sum(a[:place]))


import sys
n = sys.stdin.readline()
print(sum(map(abs, map(int, sys.stdin.readline().strip().split()))))


n = int(input())
t = 0
B = 0
C = 0
for i in input().split():
	t = int(i)
	if t < 0:
		C += t
	else:
		B += t
print(B - C)


n = int(input())
l = [int(x) for x in input().split()]
q = []
m = []
for i in range(n):
	if l[i] < 0:
		m.append(l[i])
	else:
		q.append(l[i])
print(sum(q) - sum(m))


def rearPosNeg(arr, n, i):
	for j in range(n):
		if arr[j] < 0:
			i += 1
			(arr[i], arr[j]) = (arr[j], arr[i])
	b = arr[i + 1:]
	c = arr[:i + 1]
	print(sum(b) - sum(c))
n = int(input().strip())
arr = list(map(int, input().strip().split()))
i = -1
rearPosNeg(arr, n, i)


class CodeforcesTask946ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.sequence = []

	def read_input(self):
		self.n = int(input())
		self.sequence = [int(x) for x in input().split(' ')]

	def process_task(self):
		self.result = str(sum([abs(x) for x in self.sequence]))

	def get_result(self):
		return self.result
Solution = CodeforcesTask946ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = input()
ai = list(map(int, input().split()))
(b, c) = (0, 0)
for i in ai:
	if i > 0:
		b = b + i
	else:
		c = c + i
print(b - c, end='')


n = int(input())
a = list(map(int, input().split()))
c = 0
c1 = 0
for i in range(len(a)):
	if a[i] > 0:
		c += a[i]
	elif a[i] < 0:
		c1 += abs(a[i])
print(c + c1)


n = int(input())
x = list(map(int, input().split()))[:n]
p = 0
n = 0
for i in x:
	if i < 0:
		n += i
	else:
		p += i
print(p - n)


n = int(input())
nums = [k for k in map(int, input().split())]
b = sum((k for k in nums if k > 0))
c = sum((k for k in nums if k < 0))
print(b - c)


n = int(input())
a = list(map(int, input().split()))
c = []
for i in a:
	if i < 0:
		c.append(i)
print(sum(a) - 2 * sum(c))


n = input().split()
arr = list(map(int, input().split()))
arr1 = [i for i in arr if i > 0]
arr2 = [i for i in arr if i < 0]
B = 0
for i in arr1:
	B += i
C = 0
for i in arr2:
	C += i
print(B - C)


n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
for i in range(n):
	if a[i] < 0:
		c += 1
print(sum(a[c:n]) - sum(a[0:c]))


class Partition:

	def main(self):
		n = int(input())
		a = [int(x) for x in input().split()]
		b = []
		c = []
		for i in range(n):
			if a[i] >= 0:
				b.append(a[i])
			else:
				c.append(a[i])
		print(sum(b) - sum(c))
p = Partition()
p.main()


import sys
import os
import math
import re
x = input()
a = list(map(int, input().split()))
b = []
c = []
b.append(0)
c.append(0)
if len(a) == 1:
	print(abs(a[0]))
else:
	for i in range(len(a)):
		if a[i] < 0:
			c.append(a[i])
		else:
			b.append(a[i])
	print(sum(b) - sum(c))


def main():
	n = int(input())
	vals = [int(v) for v in input().split()]
	vals.sort()
	m = sum(vals)
	for i in range(n + 1):
		cur = sum(vals[i:]) - sum(vals[:i])
		if cur > m:
			m = cur
	print(m)
main()


x = int(input())
y = [int(n) for n in input().split()]
m = k = 0
for n in range(x):
	if y[n] >= 0:
		m += y[n]
	else:
		k += y[n]
print(m - k)


n = int(input())
k = list(map(int, input().split()))
li = []
l = []
for i in k:
	if i < 0:
		li.append(i)
	else:
		l.append(i)
print(sum(l) - sum(li))


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	l = LI()
	x = []
	y = []
	for a in l:
		if a >= 0:
			x.append(a)
		else:
			y.append(a)
	x.sort()
	y.sort()
	if len(x) == 0:
		return -sum(y)
	elif len(y) == 0:
		return sum(x)
	else:
		return sum(x) - sum(y)
print(main())


elements = int(input())
sequence = [int(x) for x in input().split()]
(negative, positive) = (0, 0)
for number in sequence:
	if number >= 0:
		positive += number
	else:
		negative += number * -1
print(positive + negative)


n = int(input())
count = 0
a = [int(x) for x in input().split()]
for i in range(n):
	if a[i] < 0:
		a[i] = -a[i]
	count += a[i]
print(count)


n = int(input())
myList = list(map(int, input().split()))
sumB = 0
sumC = 0
for i in range(0, len(myList)):
	if myList[i] >= 0:
		sumB += myList[i]
	else:
		sumC += myList[i]
mySum = sumB - sumC
print(mySum)


gi = lambda : list(map(int, input().split()))
(n,) = gi()
print(sum(list(map(abs, gi()))))


n = int(input())
res = 0
for i in [int(x) for x in input().split()]:
	res += abs(i)
print(res)


n = int(input())
array = input().split(' ')
array = [int(array[i]) for i in range(n)]
posi = [each for each in array if each >= 0]
neg = [each for each in array if each < 0]
print(sum(posi) - sum(neg))


n = int(input())
l = [int(x) for x in input().split()]
val = sum([x for x in l if x > 0])
neg = sum([x for x in l if x < 0])
print(val - neg)


n = int(input())
arr = [abs(int(i)) for i in input().strip().split()]
print(sum(arr))


n = int(input())
L = list(map(int, input().split()))
L = list(map(abs, L))
print(sum(L))


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
n = int(input())
A = list(map(int, input().split()))
pos = 0
neg = 0
for i in A:
	if i < 0:
		neg = neg + i
	else:
		pos = pos + i
print(pos - neg)


n = int(input())
a = list(map(int, input().split()))
t = min(a)
if t < 0:
	p = 0
	n = 0
	for i in a:
		if i > 0:
			p += i
		else:
			n += i
	print(p - n)
else:
	print(sum(a))


from math import fabs as abs
a = int(input())
b = list(map(int, input().split()))
for i in range(a):
	b[i] = abs(b[i])
print(int(sum(b)))


n = int(input())
a = list(map(int, input().split()))
b = []
c = []
for k in a:
	if k > 0:
		b.append(k)
	else:
		c.append(k)
print(sum(b) - sum(c))


n = int(input())
s = [int(x) for x in input().split()]
b = []
c = []
for i in s:
	if i > 0:
		b.append(i)
	else:
		c.append(i)
print(sum(b) - sum(c))


(n, m) = (int(input()), 0)
for i in map(int, input().split()):
	if i < 0:
		m -= i
	else:
		m += i
print(m)


input()
n = sorted(list(map(int, input().split())))
from bisect import bisect
i = bisect(n, 0)
print(sum(n[i:]) - sum(n[:i]))


input()
l = sorted(list(map(int, input().split())))
A = 0
for i in l:
	A += max(i, -i)
print(A)


a = input()
b = list(map(int, input().split()))
c = list(map(abs, b))
print(sum(c))


a = input()
b = input().split(' ')
B = []
C = []
s1 = 0
s2 = 0
for i in b:
	i = int(i)
	if i >= 0:
		B.append(i)
	else:
		C.append(i)
for j in range(len(B)):
	s1 += B[j]
for k in range(len(C)):
	s2 += C[k]
print(s1 - s2)


n = int(input())
A = list(map(int, input().split()))
b = 0
c = 0
for i in range(n):
	if A[i] > 0:
		b += A[i]
	else:
		c += A[i]
print(b - c)


input()
seq = map(lambda x: abs(int(x)), input().split())
print(sum(seq))


n = input()
n = input()
x = []
x = n.split()
negative = 0
positive = 0
for i in x:
	if int(i) > 0:
		positive = positive + int(i)
	else:
		negative = negative + int(i)
print(positive - negative)


n = int(input())
a = map(int, input().split(' '))
sum = 0
for x in a:
	if x > 0:
		sum += x
	else:
		sum += -x
print(sum)


n = int(input())
t = map(int, input().split())
ans = 0
for i in t:
	ans += abs(i)
print(ans)


n = int(input())
array = map(int, input().split())
print(sum((abs(k) for k in array)))


n = int(input())
v = []
q = []
l = list(map(int, input().split()))
for i in range(len(l)):
	if abs(l[i]) != l[i]:
		q.append(l[i])
	else:
		v.append(l[i])
print(sum(v) - sum(q))


n = int(input())
arr = list(map(int, input().split()))
pos = 0
neg = 0
for i in range(n):
	if arr[i] >= 0:
		pos += arr[i]
	else:
		neg += arr[i]
print(pos - neg)


n = int(input())
ai = list(map(int, input().split()))
a = 0
for i in range(n):
	a += abs(ai[i])
print(a)


n = int(input())
a = [int(x) for x in input().split()]
B = [x for x in a if x >= 0]
C = [x for x in a if x < 0]
print(sum(B) - sum(C))


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su
n = inin()
arr = inar()
a = 0
b = 0
for i in arr:
	if i < 0:
		b += i
	else:
		a += i
print(a - b)


n = int(input())
arr = list(map(int, input().strip().split(' ')))
s = 0
for i in range(n):
	s += abs(arr[i])
print(s)


n = eval(input())
a = list(map(int, input().split()))
sum1 = 0
sum2 = 0
for i in range(n):
	if a[i] >= 0:
		sum1 += a[i]
	else:
		sum2 += a[i]
print(sum1 - sum2)


n = int(input())
arr = list(map(int, input().split()))
b = c = 0
for val in arr:
	if val >= 0:
		b += val
	else:
		c += val
print(b - c)


import sys
n = int(input())
a = list(map(int, input().split()))
b = list((x for x in a if x >= 0))
c = list((x for x in a if x < 0))
print(sum(b) - sum(c))


input()
a = list(map(int, input().split()))
s = 0
for i in range(len(a)):
	s += abs(a[i])
print(s)


n = int(input())
print(sum(list(map(lambda i: abs(int(i)), input().split()))))


n = int(input())
a = []
a = list(map(int, input().split()))
e = []
b = []
theSum = 0
theum = 0
for i in range(len(a)):
	if a[i] < 0:
		e.append(a[i])
	else:
		b.append(a[i])
for i in b:
	theSum = theSum + i
for i in range(len(e)):
	theum += e[i]
print(theSum - theum)


def main():
	n = int(input())
	lst = list(map(int, input().split()))
	sm = 0
	for i in lst:
		sm += abs(i)
	print(sm)
t = 1
for i in range(t):
	main()


n = int(input())
posl = list(map(int, input().split()))
posl.sort()
first_pos = 0
for i in range(len(posl)):
	if posl[first_pos] < 0:
		first_pos += 1
	else:
		break
cs = sum(posl[:first_pos])
bs = sum(posl[first_pos:])
print(bs - cs)


n = int(input())
a = list(map(int, input().split()))
print(2 * sum([x for x in a if x >= 0]) - sum(a))


N = int(input())
intput = lambda : map(int, input().split())
ans = 0
nums = intput()
for n in nums:
	ans += n if n > 0 else -n
print(ans)


a = int(input())
S = [int(i) for i in input().split()]
sum1 = 0
for i in range(a):
	if S[i] >= 0:
		sum1 += S[i]
	else:
		sum1 -= S[i]
print(sum1)


n = input()
print(sum([abs(int(t)) for t in input().split()]))


n = int(input())
ai = list(map(int, input().split()))
(A, B) = ([], [])
for i in ai:
	if i < 0:
		A.append(i)
	else:
		B.append(i)
print(sum(B) - sum(A))


n = int(input())
A = [int(i) for i in input().split(' ')]
A.sort()
mx = 0
ans = max([abs(sum(A[i:]) - sum(A[:i])) for i in range(0, n)])
print(ans)


n = int(input())
pos = 0
neg = 0
for g in map(int, input().split()):
	if g > 0:
		pos += g
	if g <= 0:
		neg += -g
print(pos + neg)


q = int(input())
w = list(map(int, input().split()))
e = []
for i in w:
	if i < 0:
		e.append(i)
print(sum(w) - 2 * sum(e))


n = int(input())
a = list(map(int, input().split()))
k = 0
for i in range(len(a)):
	if a[i] >= 0:
		k += a[i]
	else:
		k -= a[i]
print(k)


n = input()
a = []
b = []
c = []
s1 = 0
s2 = 0
a = list(input().split(' '))
for i in range(int(n)):
	if int(a[i]) < 0:
		c.append(int(a[i]))
	else:
		b.append(int(a[i]))
for i in range(len(c)):
	s1 = s1 + c[i]
for i in range(len(b)):
	s2 = s2 + b[i]
print(s2 - s1)


n = int(input())
lst = list(map(lambda x: abs(int(x)), input().split()))
print(sum(lst))


input()
A = list(map(int, input().split()))
A = [-x if x < 0 else x for x in A]
print(sum(A))


(n, a, ans) = (input(), list(map(int, input().split())), 0)
for num in a:
	if num < 0:
		ans -= num
	else:
		ans += num
print(ans)


input()
A = list(map(int, input().split()))
(B, C) = (0, 0)
for a in A:
	if a < 0:
		C -= a
	else:
		B += a
print(B + C)


n = int(input())
ls = list(map(int, input().split()))
sumb = 0
sumc = 0
for i in range(0, n):
	if ls[i] >= 0:
		sumb += ls[i]
	else:
		sumc += ls[i]
print(sumb - sumc)


n = int(input())
a = [int(x) for x in input().split()]
b = 0
c = 0
for i in range(0, len(a)):
	if a[i] >= 0:
		b = b + a[i]
	else:
		c = c + a[i]
print(b - c)


n = int(input())
l = list(map(int, input().split()))
b_sum = c_sum = 0
for i in l:
	if i <= 0:
		c_sum += i
	else:
		b_sum += i
print(b_sum - c_sum)


n = int(input())
a = list(map(int, input().split()))
b = sum(filter(lambda x: x > 0, a))
c = sum(filter(lambda x: x < 0, a))
print(b - c)


import sys

def main():
	return sum((abs(int(i)) for i in sys.stdin.read().strip().split()[1:]))
print(main())


n = int(input())
L = input().split()
a = list(map(int, L))
suma = 0
sumb = 0
for i in range(n):
	if a[i] > 0:
		suma = suma + a[i]
	else:
		suma = suma - a[i]
print(suma)


n = int(input())
A = list(map(int, input().split()))
B = [abs(a) for a in A]
print(sum(B))


n = int(input().strip())
a = list(map(int, input().rstrip().split()))
b = []
c = []
for i in range(0, n):
	if a[i] > 0:
		b.append(a[i])
	else:
		c.append(a[i])
print(sum(b) - sum(c))


n = int(input())
st = input()
B = st.split(' ')
b = []
c = []
for i in B:
	if int(i) >= 0:
		b.append(int(i))
	else:
		c.append(int(i))
print(sum(b) - sum(c))


n = input()
a = input()
a = a.split(' ')
for i in range(0, len(a)):
	a[i] = int(a[i])
b = []
c = []
for item in a:
	if item > 0:
		b.append(item)
	else:
		c.append(item)
print(sum(b) - sum(c))


n = int(input())
sum1 = 0
sum2 = 0
x = input().split()
x = list(map(int, x))
for i in range(n):
	if x[i] > 0:
		sum1 = sum1 + x[i]
	else:
		sum2 = sum2 + x[i]
print(sum1 - sum2)


n = int(input())
print(sum(map(lambda s: abs(int(s)), input().split())))


__author__ = 'Dilshod'
n = int(input())
m = list(map(int, input().split()))
b = []
for i in range(n):
	if m[i] < 0:
		b += [m[i]]
		m[i] = 0
print(sum(m) - sum(b))


input()
A = sorted(map(int, input().split()))
print(sum((a for a in A if a > 0)) - sum((b for b in A if b < 0)))


tCases = input()
lis = list(map(int, input().split()))
(b, c) = (0, 0)
for x in lis:
	if x >= 0:
		b += x
	else:
		c += x
print(b - c)


n = int(input())
l = list(map(int, input().split()))
nL = []
pL = []
for i in range(n):
	if l[i] < 0:
		nL.append(l[i])
	else:
		pL.append(l[i])
print(sum(pL) - sum(nL))


def f(l, n, x):
	if n == 0:
		return x
	elif l[n - 1] >= 0:
		return f(l, n - 1, x + l[n - 1])
	else:
		return f(l, n - 1, x - l[n - 1])
n = int(input())
l = list(map(int, input().split()))
x = f(l, n, 0)
print(x)


n = int(input())
l = list(map(int, input().split()))
l.sort()
C = sum(l)
B = 0
R = B - C
for i in range(len(l) - 1, -1, -1):
	B += l[i]
	C -= l[i]
	if B - C >= R:
		R = B - C
	else:
		break
print(R)


n = int(input())
ar = list(map(int, input().split()))
count = 0
for i in ar:
	if i > 0:
		count += i
	else:
		count -= i
print(count)


def solve(n, a):
	sump = sum([i for i in a if i > 0])
	sumn = sum([i for i in a if i <= 0])
	return sump - sumn

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))
main()


a = int(input())
b = [int(i) for i in input().split()]
c = 0
for i in range(len(b)):
	c += abs(b[i])
print(c)


n = int(input())
array1 = list(map(int, input().split(' ')))
sum1 = 0
sum2 = 0
for i in range(n):
	if array1[i] < 0:
		sum1 = sum1 + array1[i]
	else:
		sum2 = sum2 + array1[i]
result = abs(sum1 - sum2)
print(result)


n = int(input())
A = list(map(int, input().split()))
print(sum((A[i] for i in range(n) if A[i] > 0)) - sum((A[i] for i in range(n) if A[i] < 0)))


numElements = int(input(''))
print(sum([abs(int(x)) for x in input('').split(' ')]))


x = input()
arr = list(map(int, input().split()))
(positive, negative) = (0, 0)
for i in arr:
	if i > 0:
		positive += i
	else:
		negative += i
print(positive - negative)


import math
n = int(input())
a = sorted(input().split())
b = 0
c = 0
while len(a) > 0:
	if int(a[len(a) - 1]) < 0:
		c += int(a[len(a) - 1])
	else:
		b += int(a[len(a) - 1])
	a = a[:-1]
print(b - c)


a = int(input())
b = input().split()
sum = 0
for i in range(a):
	if int(b[i]) >= 0:
		sum += int(b[i])
	else:
		sum -= int(b[i])
print(sum)


n = int(input())
a = [int(i) for i in input().split()]
B = 0
C = 0
for i in range(n):
	if a[i] >= 0:
		B += a[i]
	else:
		C += a[i]
print(B - C)


from functools import reduce
n = int(input())
L = list(map(int, input().split()))
s = 0
for i in range(0, len(L)):
	s += abs(L[i])
print(s)


nelements = int(input().strip())
numbers = input().split(' ')
b = 0
for x in range(nelements):
	temp = int(numbers[x])
	if temp > 0:
		b += temp
	else:
		b += temp * -1
print(b)


a = int(input())
a_n = [int(z) for z in input().split()]
b = []
c = []
for i in a_n:
	if i >= 0:
		b.append(i)
	else:
		c.append(i)
print(sum(b) - sum(c))


n = int(input())
k = 0
h = 0
a = list(map(int, input().split()))
for t in a:
	if t < 0:
		h += abs(t)
	else:
		k += t
print(k + h)


n = int(input())
l = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
for i in l:
	if i <= 0:
		cnt1 += i
	elif i >= 0:
		cnt2 += i
print(cnt2 - cnt1)


def fun(m):
	c = []
	b = []
	for i in m:
		if i < 0:
			c.append(i)
		else:
			b.append(i)
	ans = sum(b) - sum(c)
	return ans
n = int(input())
l = list(map(int, input().split()))
print(fun(l))


n = int(input())
list1 = [int(x) for x in input().split()]
pos = []
neg = []
for i in list1:
	if i > 0:
		pos.append(i)
	else:
		neg.append(i)
print(sum(pos) - sum(neg))


n = int(input())
a = []
a = [int(x) for x in input().split()]
B = 0
C = 0
for e in a:
	if e > 0:
		B += e
	else:
		C += e
print(B - C)


n = int(input())
pre = [int(i) for i in input().split()]
ans1 = 0
ans2 = 0
for i in pre:
	if i < 0:
		ans1 += i
	else:
		ans2 += i
print(ans2 - ans1)


n = int(input())
A = [*map(int, input().split())]
(pos, neg) = (0, 0)
for a in A:
	if a > 0:
		pos += a
	else:
		pos += -a
print(pos - neg)


n = int(input())
a = input().split(' ')
summ = 0
for t in a:
	summ += abs(int(t))
print(summ)


n = int(input())
a = [int(i) for i in input().split()]
(flag, c) = (True, 0)
for i in a:
	if i < 0:
		flag = False
		c += i
if flag:
	print(sum(a))
else:
	print(sum(a) - 2 * c)


n = int(input())
m = 0
m1 = 0
a = [int(i) for i in input().split()]
for i in a:
	if i < 0:
		m += i
	else:
		m1 += i
print(m1 - m)


n = int(input())
l = list(map(int, input().split()))
c = []
d = []
m = min(l)
if m >= 0:
	print(sum(l))
else:
	for i in range(n):
		if l[i] < 0:
			c.append(l[i])
		else:
			d.append(l[i])
	print(sum(d) - sum(c))


n = int(input())
l = list(map(int, input().split()))
l = sum(map(abs, l))
print(l)


n = int(input())
a = list(map(int, input().split()))
if min(a) < 0:
	ss = 0
	sp = 0
	for i in a:
		if i < 0:
			ss = abs(i) + ss
		else:
			sp = i + sp
	print(ss + sp)
else:
	print(sum(a))


n = int(input())
l = input().split(' ')
sum1 = 0
sum2 = 0
for i in l:
	if int(i) > 0:
		sum1 += int(i)
	else:
		sum2 += int(i)
print(sum1 - sum2)


n = int(input())
a = [int(i) for i in input().split()]
sum_ = 0
for i in a:
	sum_ += abs(i)
print(sum_)


n = int(input())
raw = input()
arr = raw.split()
diff = 0
for i in arr:
	a = int(i)
	if a < 0:
		diff -= a
	else:
		diff += a
print(diff)


a = int(input())
arr = [int(x) for x in input().split()]
sum_pos = 0
sum_neg = 0
for i in arr:
	if i < 0:
		sum_neg = sum_neg + i
	else:
		sum_pos = sum_pos + i
print(abs(sum_neg) + sum_pos)


list_a = []
sum_b = 0
sum_c = 0
n = int(input())
tmp = input()
list_a = [int(r) for r in tmp.split()]
for i in list_a:
	if i > 0:
		sum_b = sum_b + i
	else:
		sum_c = sum_c + i
print(sum_b - sum_c)


N = int(input().strip())
a = list(map(int, input().strip().split()))
b = 0
c = 0
for i in range(N):
	if a[i] > 0:
		b += a[i]
	else:
		c += a[i]
print(b - c)


n = map(int, input().split())
nums = list(map(int, input().split()))
nums = sorted(nums)
stopped_index = 0
for (i, v) in enumerate(nums):
	if v <= 0:
		stopped_index += 1
	else:
		break
print(sum(nums[stopped_index:]) - sum(nums[0:stopped_index]))


n = int(input())
l = [int(x) for x in input().split()]
count = 0
for i in l:
	if i < 0:
		count -= i
	else:
		count += i
print(count)


n = int(input())
a = sorted(list(map(int, input().split())))
s = 0
for i in a:
	if i < 0:
		s += i
	else:
		break
print(sum(a) + -2 * s)


n = int(input())
lst = list(map(int, input().split()))
ans = 0
for i in lst:
	ans += abs(i)
print(ans)


import sys
inputData = sys.stdin.readlines()
inputData = inputData[1:]
inputData = [int(x) for x in inputData[0].split()]
inputData = [-x if x < 0 else x for x in inputData]
print(sum(inputData))


n = eval(input())
a = list(map(int, input().split()))
c = [0] * n
b = [0] * n
i = 0
while i < len(a):
	if a[i] < 0:
		c[i] = c[i] + a[i]
	i += 1
sum1 = sum(c)
i = 0
while i < len(a):
	if a[i] > 0:
		b[i] = b[i] + a[i]
	i += 1
sum2 = sum(b)
print(sum2 - sum1)


n = input()
n = int(n)
ans = 0
b = input()
b = b.split()
for i in b:
	ans = ans + abs(int(i))
print(ans)


n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
	if a[i] < 0:
		ans += -1 * a[i]
	else:
		ans += a[i]
print(ans)


n = int(input())
arrs = map(int, input().split())
b = []
c = []
for num in arrs:
	if num >= 0:
		b.append(num)
	else:
		c.append(num)
print(sum(b) - sum(c))


import sys, os

def main():
	a = sys.stdin.readline()
	a = list(map(int, sys.stdin.readline().rstrip().split()))
	b = sum([x for x in a if x < 0])
	c = sum([x for x in a if x > 0])
	print(c - b)
main()


n = int(input())
a = list(map(int, input().split()))
B = []
c = []
for item in a:
	if item >= 0:
		B.append(item)
	else:
		c.append(item)
print(sum(B) - sum(c))


input()
print(eval(input().replace('-', '').replace(' ', '+')))


n = int(input())
dat = list(map(int, input().split()))
res = 0
for x in dat:
	res += abs(x)
print(res)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 15
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = LI()
	r = 0
	for c in a:
		if c > 0:
			r += c
		else:
			r -= c
	return r
print(main())


def test_1():
	n = list(map(int, input().split(' ')))[0]
	data = list(map(int, input().split(' ')))
	data_1 = sorted(data)
	data_2 = []
	data_3 = []
	for i in range(n):
		if data_1[i] < 0:
			data_2.append(data_1[i])
		else:
			data_3.append(data_1[i])
	out = sum(data_3) - sum(data_2)
	print(out)
test_1()


n = int(input())
num = list(map(int, input().split()))
neg = 0
pos = 0
for x in num:
	if x >= 0:
		pos += x
	else:
		neg += x
print(pos - neg)


n = int(input())
l = list(map(int, input().split()))
k = []
p = []
for i in range(n):
	if l[i] < 0:
		k.append(l[i])
for j in range(n):
	if l[j] >= 0:
		p.append(l[j])
sum1 = sum(k)
sum2 = sum(p)
print(sum2 - sum1)


I = input
I()
ls = list(map(int, I().split()))
ans = 0
for _ in ls:
	if _ < 0:
		_ = -_
	ans += _
print(ans)


n = int(input())
a = [int(t) for t in input().strip().split(' ')]
b = []
c = []
for i in range(n):
	if a[i] > 0:
		b.append(a[i])
	else:
		c.append(a[i])
if sum(c) == 0:
	print(sum(b))
else:
	print(sum(b) - sum(c))


n = int(input())
a = [int(x) for x in input().split()]
b = 0
c = 0
for elem in a:
	if elem < 0:
		c += elem
	else:
		b += elem
print(b - c)


n = int(input())
l = list(map(int, input().split()))
d = [0]
z = [0]
for i in l:
	if i < 0:
		d.append(i)
	else:
		z.append(i)
print(sum(z) - sum(d))


getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
n = int(input())
a = [0]
b = [0]
arr = getInputIntList()
for i in arr:
	if i > 0:
		a.append(i)
	else:
		b.append(i)
print(sum(a) - sum(b))


b = input()
a = [abs(int(i)) for i in input().split()]
print(sum(a))


n = int(input())
a = []
b = []
for i in map(int, input().split()):
	if i > -1:
		a.append(i)
	else:
		b.append(i)
print(sum(a) - sum(b))


n = int(input())
a = [int(i) for i in input().split()]
sum = 0
sums = 0
for i in range(0, len(a)):
	if a[i] <= 0:
		sum = sum + a[i]
	else:
		sums = sums + a[i]
print(sums - sum)


n = int(input())
L = list(map(int, input().split()))
B = 0
C = 0
for i in L:
	if i < 0:
		C += i
	else:
		B += i
print(B - C)


n = int(input())
x = list(map(int, input().split()))
ans = 0
for el in x:
	ans += abs(el)
print(ans)


n = int(input())
a = map(int, input().split())
(s1, s2) = (0, 0)
for ai in a:
	if ai > 0:
		s1 += ai
	else:
		s2 += ai
print(s1 - s2)


n = int(input())
a = [int(x) for x in input().split()]
l = []
for i in a:
	if i < 0:
		l.append(i)
	else:
		continue
print(sum(a) - 2 * sum(l))


n = int(input())
numbers = list(map(int, input().split()))
negative_numbers = []
positive_numbers = []
for number in numbers:
	if number >= 0:
		positive_numbers.append(number)
	else:
		negative_numbers.append(number)
if len(negative_numbers) > 0:
	if len(positive_numbers) > 0:
		result = sum(positive_numbers) - sum(negative_numbers)
	elif len(negative_numbers) == 1:
		result = -negative_numbers[0]
	else:
		result = -sum(negative_numbers)
else:
	result = sum(positive_numbers)
print(result)


ans = 0
input()
l = [int(i) for i in input().split()]
for num in l:
	ans += abs(num)
print(ans)


n = int(input())
L = list(map(int, input().split(' ')))
su = 0
for i in range(n):
	su = su + abs(L[i])
print(su)


a = int(input())
b = input().split()
d = []
e = []
for i in range(a):
	b[i] = int(b[i])
	if b[i] < 0:
		e.append(b[i])
	else:
		d.append(b[i])
print(sum(d) - sum(e))


a = int(input())
(f, l) = (0, sorted(list(map(int, input().split()))))
for x in range(a):
	if l[x] >= 0:
		f = 1
		break
if f == 1:
	print(sum(l[x:]) - sum(l[:x]))
else:
	print(abs(sum(l)))


i = int(input())
test = list(map(int, input().split()))
b = []
c = []
for i in test:
	if i > 0:
		b.append(i)
	else:
		c.append(i)
print(sum(b) - sum(c))


def main():
	n = int(input())
	sequence = list(map(int, input().split()))
	print(sum(list(map(abs, sequence))))
main()


n = int(input())
s = input().split()
cl = []
for i in s:
	cl.append(int(i))
cl = sorted(cl)
mx = -10 ** 9
for i in range(n + 1):
	if abs(sum(cl[:i]) - sum(cl[i:])) > mx:
		mx = abs(sum(cl[:i]) - sum(cl[i:]))
print(mx)


n = int(input())
numbers = input().split(' ')
numbers = list(map(int, numbers))
b = 0
c = 0
for i in range(0, len(numbers)):
	if numbers[i] > 0:
		b += numbers[i]
	else:
		c += numbers[i]
print(b - c)


n = int(input())
a = list(map(int, input().split()))
x = list(map(lambda x: abs(x), a))
print(sum(x))


n = int(input())
judo = list(map(int, input().split()))
(pos, neg) = (0, 0)
for i in judo:
	if i < 0:
		neg += i
	if i > 0:
		pos += i
print(pos - neg)


n = int(input())
A = list(map(int, input().split()))
X = []
Y = []
for i in range(len(A)):
	if A[i] < 0:
		Y.append(A[i])
	else:
		X.append(A[i])
sumx = 0
sumy = 0
for j in range(len(X)):
	sumx += X[j]
for k in range(len(Y)):
	sumy += Y[k]
print(sumx - sumy)


n = int(input())
arr = [int(i) for i in input().split()]
(b, c) = (0, 0)
for i in range(0, n):
	if arr[i] <= 0:
		c += arr[i]
	else:
		b += arr[i]
print(b - c)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
A = map(int, input().split())
ans = sum([abs(x) for x in A])
print(ans)


elements = int(input())
sequence = [int(x) for x in input().split()]
c = 0
b = 0
for x in range(elements):
	if sequence[x] >= 0:
		b = b + sequence[x]
	else:
		c = c + sequence[x]
total = b - c
print(total)


import sys
import math
import bisect

def main():
	n = int(input())
	A = list(map(int, input().split()))
	B = []
	C = []
	for a in A:
		if a >= 0:
			B.append(a)
		else:
			C.append(a)
	print(sum(B) - sum(C))
main()


input()
print(sum([abs(i) for i in list(map(int, input().split()))]))


n = int(input())
l = list(map(int, input().split()))
re = 0
for i in range(n):
	if l[i] < 0:
		re = re - l[i]
	else:
		re = re + l[i]
print(re)


n = int(input())
arr = list(map(int, input().split()))
answer = 0
for i in arr:
	answer += abs(i)
print(answer)


n = int(input())
l = list(map(int, input().split()))
a = int(0)
b = int(0)
for i in range(n):
	if l[i] >= 0:
		a += l[i]
	else:
		b += l[i]
print(a + abs(b))


n = int(input())
a = [int(x) for x in input().split()]
a1 = 0
a2 = 0
for i in a:
	if i > 0:
		a2 += i
	else:
		a1 += i
print(a2 - a1)


def main():
	input()
	print(sum(map(abs, map(int, input().split()))))
main()


n = int(input())
l = list(map(int, input().split()))
c = 0
s = 0
for i in range(n):
	if l[i] >= 0:
		c += l[i]
	if l[i] < 0:
		s += l[i]
print(c - s)


n = int(input())
a = list(map(int, input().split()))
B = 0
C = 0
for i in range(len(a)):
	if a[i] < 0:
		C += a[i]
	else:
		B += a[i]
print(B - C)


b = []
c = []
n = int(input().strip())
A = list(map(int, input().split(' ')))
for t in A:
	if t >= 0:
		b.append(t)
	else:
		c.append(t)
s = sum(b) - sum(c)
print(s)


n = int(input())
l = list(map(int, input().split()))
ans = 0
for elem in l:
	if elem < 0:
		ans += -1 * elem
	else:
		ans += elem
print(ans)


def solve(line, out):
	gi = lambda : list(map(int, line().split()))
	line()
	out(str(sum(list(map(abs, gi())))))
solve(input, print)


import math
n = int(input())
a = list(map(int, input().split()))
sum1 = int(math.fsum(a))
a = list(filter(lambda x: x < 0, a))
sum1 -= 2 * int(math.fsum(a))
print(sum1)


n = int(input())
a = list(map(int, input().split()))
c = []
a.sort()
if a[0] >= 0:
	print(sum(a))
	exit()
for i in range(n):
	if a[i] < 0:
		c.append(a[i])
		a[i] = 0
	else:
		break
print(sum(a) - sum(c))


def main():
	n = map(int, input().split())
	arr = list(map(int, input().split()))
	print(sum([x for x in arr if x > 0]) - sum([x for x in arr if x < 0]))
main()


def main():
	n = int(input())
	x = list(map(int, input().split()))
	y = [0]
	for i in range(n):
		if x[i] < 0:
			y.append(x[i])
			x[i] = 0
	print(sum(x) - sum(y))
main()


N = int(input())
array = map(int, input().split())
print(sum((abs(k) for k in array)))


n = int(input())
a = [int(x) for x in input().split()]
sumB = 0
sumC = 0
for x in a:
	if x >= 0:
		sumB += x
	else:
		sumC += x
print(sumB - sumC)


input()
a = list(map(int, input().split()))
l = 0
for i in range(len(a)):
	if a[i] >= 0:
		l = l + a[i]
	else:
		l = l - a[i]
print(l)


n = int(input())
a = [int(a) for a in input().strip().split()]
bb = int()
cc = int()
for i in range(n):
	if a[i] > 0:
		bb = bb + a[i]
	elif a[i] < 0:
		cc = cc + a[i]
print(bb - cc)


input()
a = map(int, input().split())
a = [abs(i) for i in a]
print(sum(a))


a = int(input())

def k(b, c=0, i=0):
	if i < a and b[i] >= 0:
		return k(b, c + b[i], i + 1)
	elif i < a:
		return k(b, c - b[i], i + 1)
	else:
		print(c)
k(list(map(int, input().split())))


n = int(input())
arr = [int(i) for i in input().split()][:n]
b = []
c = []
for i in range(n):
	if arr[i] >= 0:
		b.append(arr[i])
	else:
		c.append(arr[i])
s1 = sum(b)
s2 = sum(c)
print(s1 - s2)


i = input
i()
s = 0
for i in i().split():
	i = int(i)
	s += i if i > 0 else -i
print(s)


from sys import stdin, stdout
n = int(stdin.readline())
(first, second) = (0, 0)
values = list(map(int, stdin.readline().split()))
for v in values:
	if v >= 0:
		first += v
	else:
		second += v
stdout.write(str(first - second))


n = int(input())
l = list(map(int, input().split()))
p = []
n = []
for i in l:
	if i > 0:
		p.append(i)
	else:
		n.append(i)
print(sum(p) - sum(n))


input()
mySum = 0
for i in [int(x) for x in input().split()]:
	mySum += abs(i)
print(mySum)


n = int(input())
a = list(map(int, input().split()))
a.sort()
po = 0
ne = 0
for i in range(len(a)):
	if a[i] < 0:
		ne += a[i]
	if a[i] >= 0:
		po += a[i]
print(po - ne)


x = int(input())
y = [int(i) for i in input().split()]
z = 0
for i in y:
	z += abs(i)
print(z)


n = int(input())
arr = list(map(int, input().split()))
a = b = 0
for i in range(n):
	if arr[i] > 0:
		a += arr[i]
	else:
		b += arr[i]
print(a - b)


def solve():
	n = int(input())
	A = list(map(int, input().split()))
	res = 0
	for a in A:
		if a >= 0:
			res += a
		else:
			res -= a
	print(res)

def __starting_point():
	solve()
__starting_point()


n = int(input())
a = [int(x) for x in input().split()]
b = 0
c = 0
for i in range(len(a)):
	if a[i] < 0:
		c += a[i] * -1
	elif a[i] >= 0:
		b += a[i]
ans = b + c
print(ans)


n = int(input())
arr1 = input()
arr2 = arr1.split()
arr = []
for i in arr2:
	arr.append(int(i))
left = []
right = []
for i in arr:
	if i <= 0:
		right.append(i)
	else:
		left.append(i)
k1 = sum(left)
k2 = sum(right)
diff = k1 - k2
print(diff)


n = int(input())
a = list(map(int, input().split()))
bb = 0
cc = 0
if a[0] > 0:
	bb = a[0]
else:
	cc = a[0]
for i in range(1, n):
	if a[i] > 0:
		bb += a[i]
	else:
		cc += a[i]
print(bb - cc)


n = int(input())
a = list(map(int, input().split()))
s = sum([i for i in a if i < 0])
s2 = sum([i for i in a if i > 0])
print(s2 - s)


input()
ans = 0
for x in map(int, input().split()):
	if x < 0:
		ans -= x
	else:
		ans += x
print('{}'.format(ans))


n = int(input())
c = 0
li = list(map(int, input().split()))
for i in range(n):
	c += abs(li[i])
print(c)


n = int(input())
ans = sum([abs(int(s)) for s in input().split(' ')])
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
c = 0
b = 0
for x in range(n):
	if a[x] >= 0:
		b = b + a[x]
	else:
		c = c + a[x]
t = b - c
print(t)


n = int(input())
l = list(map(int, input().split()))
cnt = 0
for x in l:
	cnt = cnt + abs(x)
print(cnt)


n = input()
a = list(map(int, input().split()))
diff = 0
for e in a:
	diff += abs(e)
print(diff)


n = int(input())
a = input().split()
li = [abs(int(i)) for i in a]
sum = 0
for i in li:
	sum += i
print(sum)


input()
seq = [int(i) for i in input().split(' ')]
b = 0
c = 0
for s in seq:
	if s >= 0:
		b += s
	else:
		c += s
print(b - c)


input()
a = input().split()
s = 0
for i in a:
	s += abs(int(i))
print(s)


n = int(input())
a = list(map(int, input().split()))
p = [i for i in a if i >= 0]
neg = [i for i in a if i < 0]
print(sum(p) - sum(neg))


n = int(input())
h = map(int, input().split())
a = [int(i) for i in h]
b = []
c = []
i = 0
while i < len(a):
	if a[i] >= 0:
		b.append(a[i])
	else:
		c.append(a[i])
	i = i + 1
x = 0
y = 0
for j in range(0, len(b)):
	x = x + b[j]
	j = j + 1
for k in range(0, len(c)):
	y = y + c[k]
	k = k + 1
print(x - y)


n = int(input())
a = list(map(int, input().split()))
b = [i for i in a if i < 0]
print(sum(a) - 2 * sum(b))


a = int(input())
c = []
k = 0
l = []
p = 0
b = map(int, input().split())
for i in b:
	if i < 0:
		c.append(i)
	else:
		l.append(i)
for i in range(len(c)):
	k += c[i]
for i in range(len(l)):
	p += l[i]
print(p - k)


n = int(input())
a = 0
for elem in input().split():
	if int(elem) >= 0:
		a += int(elem)
	else:
		a -= int(elem)
print(a)


n = int(input())
a = list(map(int, input().split()))
p = []
n = []
for i in a:
	if i <= 0:
		n.append(i)
	elif i > 0:
		p.append(i)
print(sum(p) - sum(n))


def biggestSum(nums):
	return sum(list(map(abs, nums)))
n = int(input())
nums = list(map(int, input().split()))
print(biggestSum(nums))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
array = get_list()[::-1]
s = 0
for i in array:
	s += abs(i)
print(s)


n = int(input())
numbers = [int(_) for _ in input().split()]
b = sum([x for x in numbers if x > 0])
c = sum([x for x in numbers if x < 0])
print(b - c)


n = int(input())
line = input()
nums = list(map(int, line.strip().split()))
(A, B) = (0, 0)
for item in nums:
	if item >= 0:
		A += item
	else:
		B += item
print(A - B)


n = int(input())
a = list(map(int, input().split()))
cnt = 0
cnt1 = 0
for i in a:
	if i < 0:
		cnt += i
	else:
		cnt1 += i
print(cnt1 - cnt)