[Image] 

As some of you know, cubism is a trend in art, where the problem of constructing volumetrical shape on a plane with a combination of three-dimensional geometric shapes comes to the fore. 

A famous sculptor Cicasso, whose self-portrait you can contemplate, hates cubism. He is more impressed by the idea to transmit two-dimensional objects through three-dimensional objects by using his magnificent sculptures. And his new project is connected with this. Cicasso wants to make a coat for the haters of anticubism. To do this, he wants to create a sculpture depicting a well-known geometric primitive — convex polygon.

Cicasso prepared for this a few blanks, which are rods with integer lengths, and now he wants to bring them together. The i-th rod is a segment of length l_{i}.

The sculptor plans to make a convex polygon with a nonzero area, using all rods he has as its sides. Each rod should be used as a side to its full length. It is forbidden to cut, break or bend rods. However, two sides may form a straight angle $180^{\circ}$.

Cicasso knows that it is impossible to make a convex polygon with a nonzero area out of the rods with the lengths which he had chosen. Cicasso does not want to leave the unused rods, so the sculptor decides to make another rod-blank with an integer length so that his problem is solvable. Of course, he wants to make it as short as possible, because the materials are expensive, and it is improper deed to spend money for nothing. 

Help sculptor! 


-----Input-----

The first line contains an integer n (3 ≤ n ≤ 10^5) — a number of rod-blanks.

The second line contains n integers l_{i} (1 ≤ l_{i} ≤ 10^9) — lengths of rods, which Cicasso already has. It is guaranteed that it is impossible to make a polygon with n vertices and nonzero area using the rods Cicasso already has.


-----Output-----

Print the only integer z — the minimum length of the rod, so that after adding it it can be possible to construct convex polygon with (n + 1) vertices and nonzero area from all of the rods.


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

Output
1

Input
5
20 4 3 2 1

Output
11



-----Note-----

In the first example triangle with sides {1 + 1 = 2, 2, 1} can be formed from a set of lengths {1, 1, 1, 2}. 

In the second example you can make a triangle with lengths {20, 11, 4 + 3 + 2 + 1 = 10}.

Source: codeforces | Difficulty: EASY
Tags: Geometry

Constructive algorithms


Solutions:
n = int(input())
A = list(map(int, input().split()))
print(1 + 2 * max(A) - sum(A))


n = int(input())
sz = list(map(int, input().split()))
max_sz = max(sz)
print(2 * max_sz - sum(sz) + 1)


n = int(input())
Arr = list(map(int, input().split()))
Arr.sort()
Arr.reverse()
big = Arr[0]
sum = 0
for i in range(1, len(Arr)):
	sum += Arr[i]
if sum > big:
	ans = sum - big + 1
else:
	ans = big - sum + 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
lengths_sum = sum(l)
max_l = max(l)
rest_sum = lengths_sum - max_l
if rest_sum >= max_l:
	print(1)
else:
	print(2 * max_l + 1 - lengths_sum)


n = int(input())
A = list(map(int, input().split()))
s = max(A)
t = sum(A) - s
print(s - t + 1)


import math
n = int(input())
t = []
x = 0
for i in range(1):
	t = [int(x) for x in input().split()]
	t.sort()
for i in range(n - 1):
	x = x + t[i]
if x < t[n - 1]:
	print(t[n - 1] - x + 1)
if x == t[n - 1]:
	print(1)
if x > t[n - 1]:
	print(0)


__author__ = 'Utena'
n = int(input())
rods = sorted(list(map(int, input().split())))
total = sum(rods)
t = 0
j = 0
for i in range(n - 1):
	t += rods[i]
	if t >= total - t:
		j = 1
if j == 0:
	print(2 * rods[-1] - total + 1)
else:
	print(1)


import sys
import re

def main():
	a = int(input())
	b = input().split()
	bb = []
	for num in b:
		bb.append(int(num))
	b = bb
	b.sort()
	c = b.pop()
	d = 0
	for num in b:
		d += num
	e = c - d + 1
	print(e)
	return
main()


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
(sf, sb) = (l[0], l[n - 1])
(i, j) = (0, n - 1)
while True:
	if j == i + 1:
		break
	if sf <= sb:
		i += 1
		sf += l[i]
	else:
		j -= 1
		sb += l[j]
print(abs(sb - sf) + 1)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import *
from itertools import accumulate
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
arr = rr()
arr.sort(reverse=True)
a = b = 0
for i in arr:
	if a < b:
		a += i
	else:
		b += i
if a > b:
	(a, b) = (b, a)
print(b - a + 1)


n = input()
liste = [int(element) for element in input().split(' ')]
min = liste[0]
sum_l = liste[0]
for element in liste[1:]:
	if element > min:
		min = element
	sum_l += element
answer = 1 + 2 * min - sum_l
print(answer)


n = int(input())
xs = list(map(int, input().split()))
xs.sort(reverse=True)
a = xs[0]
b = xs[1]
for i in xs[2:]:
	if a + i - b > b + i - a:
		b += i
	else:
		a += i
print(abs(a - b) + 1)


a = input()
b = input()
b = b.split()
c = []
for i in b:
	c.append(int(i))
c.sort()
c.reverse()
d = int(c[0])
for i in range(1, int(a)):
	d = d - int(c[i])
print(d + 1)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
total = sum(l)
answer = 2 * l[0] - total + 1
print(answer)


n = int(input())
a = list(map(int, input().split()))
a.sort()
print(2 * a[-1] - sum(a) + 1)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	mx = 0
	sm = 0
	for item in arr:
		if item > mx:
			mx = item
		sm += item
	sm -= mx
	print(mx - sm + 1)
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()


import sys
import os
import math
from sys import stdin, stderr, stdout, exit
n = int(stdin.readline())
a = list(map(int, stdin.readline().strip().split()))
print(2 * max(a) - sum(a) + 1)


import unittest
import sys

class Coat:

	def __init__(self, test_inputs=None):
		it = iter(test_inputs.split('\n')) if test_inputs else None

		def uinput():
			return next(it) if it else sys.stdin.readline().rstrip()
		[self.n] = map(int, uinput().split())
		self.numl = list(map(int, uinput().split()))

	def calculate(self):
		result = 0
		lsum = sum(self.numl)
		lmax = max(self.numl)
		result = 2 * lmax - lsum + 1
		return str(result)

class unitTests(unittest.TestCase):

	def test_single_test(self):
		test = '3\n1 2 1'
		d = Coat(test)
		self.assertEqual(d.n, 3)
		self.assertEqual(d.numl, [1, 2, 1])
		self.assertEqual(Coat(test).calculate(), '1')
		test = '5\n20 4 3 2 1'
		self.assertEqual(Coat(test).calculate(), '11')
		test = ''
		test = ''

	def time_limit_test(self, nmax):
		import random
		import timeit
		test = str(nmax) + ' ' + str(nmax) + '\n'
		numnums = [str(i) + ' ' + str(i + 1) for i in range(nmax)]
		test += '\n'.join(numnums) + '\n'
		nums = [random.randint(1, 10000) for i in range(nmax)]
		test += ' '.join(map(str, nums)) + '\n'
		start = timeit.default_timer()
		d = Coat(test)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTimelimit Test: ' + '{0:.3f}s (init {1:.3f}s calc {2:.3f}s)'.format(stop - start, calc - start, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(Coat().calculate())


n = int(input())
data = [int(i) for i in input().split()]
(mx, box) = (0, 0)
for i in data:
	if i > mx:
		box += mx
		mx = i
	else:
		box += i
print(mx - box + 1)


n = int(input())
rods = list(map(int, input().split()))
m = max(rods)
print(m - (sum(rods) - m) + 1)


n = int(input())
arr = list(map(int, input().split(' ')))
m = max(arr)
s = sum(arr)
print(2 * m - s + 1)


import sys
sys.stderr = sys.stdout

def rods(n, L):
	m = max(L)
	s = sum(L)
	assert s <= 2 * m
	return 2 * m - s + 1

def main():
	n = readint()
	L = readintl()
	print(rods(n, L))

def readint():
	return int(input())

def readinti():
	return map(int, input().split())

def readintt():
	return tuple(readinti())

def readintl():
	return list(readinti())

def readinttl(k):
	return [readintt() for _ in range(k)]

def readintll(k):
	return [readintl() for _ in range(k)]

def log(*args, **kwargs):
	print(*args, **kwargs, file=sys.__stderr__)
main()


n = int(input())
arr = list(map(int, input().split()))
res = 2 * max(arr) - sum(arr) + 1
print(res)


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a[:-1])
print(a[-1] - s + 1)


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


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
L = len(l)
Ans = l[L - 1] + 1
for i in range(L - 1):
	Ans -= l[i]
print(Ans)


a = int(input())
s = [int(i) for i in input().split()]
s.sort()
s.reverse()
ans = 2 * s[0] - sum(s) + 1
print(ans)


n = int(input())
arr = [int(num) for num in input().split()]
m = max(arr)
s = 0
for val in arr:
	if val != m:
		s += val
print(m + 1 - s)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
ma = a[-1]
sa = sum(a[:-1])
if ma >= sa:
	print(ma - sa + 1)
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
t = 0
a.sort(reverse=True)
for i in a:
	t += i
	s -= i
	if t >= s:
		break
print(t - s + 1)


n = int(input())
m = list(map(int, input().split(' ')))
m.sort()
a = m.pop(-1)
x = sum(m)
print(a - x + 1)


n = int(input())
z = list(map(int, input().split()))
z.sort()
s = sum(z)
print(2 * z[-1] - s + 1)


input()
s = list(map(int, input().split()))
m = max(s)
print(max(0, 2 * m + 1 - sum(s)))


n = int(input())
l = list(map(int, input().split()))
print(l.pop(l.index(max(l))) - sum(l) + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
x = 0
for i in range(1, n):
	x += a[i]
ans = abs(a[0] - x) + 1
print(ans)


n = int(input())
rods = [int(bruh) for bruh in input().split()]
rods.sort()
print(rods[-1] - sum(rods[:-1]) + 1)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
avg = sum(arr) / 2
(a, b) = (0, 0)
for i in arr:
	if a + i > avg:
		b += i
	else:
		a += i
print(abs(b - a) + 1)


from math import *
n = int(input())
arr = [int(z) for z in input().split()]
arr.sort()
s1 = sum(arr[:len(arr) - 1])
s2 = arr[-1]
assert s2 >= s1
print(s2 - s1 + 1)


input()
arr = list(map(int, input().split()))
ans = 0
tmp = sum(arr)
for i in arr:
	if i * 2 >= tmp:
		ans = 2 * i - tmp + 1
		break
print(ans)


n = int(input())
v = list(map(int, input().split()))
M = max(v)
v.remove(M)
print(M - sum(v) + 1)


n = int(input())
a = list(map(int, input().split()))
print(max(a) * 2 - sum(a) + 1)


n = int(input())
temp = input().split(' ')
rod = []
for i in range(n):
	rod.append(int(temp[i]))
rod.sort()
s = sum(rod)
ts = s
delta = []
for i in range(n):
	ts -= rod[i]
	delta.append(abs(s / 2 - ts))
d = delta.index(min(delta))
ts = 0
for i in range(d + 1):
	ts += rod[i]
print(str(s - 2 * ts + 1))


n = int(input())
d = input().split()
d = [int(x) for x in d]
m = max(d)
d.remove(m)
S = 0
for i in d:
	S += i
print(m - S + 1)


(a, b) = (input(), list(map(int, input().split())))
print(2 * max(b) + 1 - sum(b))


import math
n = int(input())
l = [int(p) for p in input().strip('\n').split(' ')]
a = max(l)
b = int(math.ceil(max(l) / 2))
c = int(math.floor(max(l) / 2)) + 1
temp = -1 * (sum(l) - a - b - c)
print(str(temp))


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
l = 0
r = 0
for x in a:
	if l < r:
		l += x
	else:
		r += x
print(abs(l - r) + 1)


v = []
n = input()
for i in input().strip().split(' '):
	v.append(int(i))
v.sort()
v = reversed(v)
unu = 0
doi = 0
for i in v:
	if unu <= doi:
		unu += i
	else:
		doi += i
print(abs(unu - doi) + 1)


read = lambda : map(int, input().split())
n = int(input())
l = list(read())
S = sum(l)
ans = max((2 * i - S for i in l)) + 1
print(ans)


n = int(input())
sides = list(map(int, input().split()))
print(2 * max(sides) - sum(sides) + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
x = a[-1]
y = sum(a) - x
print(x - y + 1)


def arr_inp():
	return [int(x) for x in input().split()]
n = int(input())
a = arr_inp()
s1 = max(a)
a.remove(s1)
s2 = sum(a)
if s1 == s2:
	print(1)
else:
	print(max(s1, s2) - min(s1, s2) + 1)


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
l = list(map(int, input().split()))
l.sort()
p = sum(l)
print(2 * l[-1] - p + 1)


n = int(input())
z = input().split()
lengths = []
i = 0
while i < n:
	lengths.append(int(z[i]))
	i += 1
i = 0
total = 0
while i < n:
	total += lengths[i]
	i += 1
x = max(lengths)
print(2 * x - total + 1)


n = input()
liste = [int(element) for element in input().split(' ')]
liste.sort()
answer = 1 + liste[-1] - (sum(liste) - liste[-1])
print(answer)


n = int(input())
lst = list(map(int, input().split()))
print(2 * max(lst) - sum(lst) + 1)


import sys
import math
import bisect

def solve(A):
	n = len(A)
	A.sort()
	max_val = A[n - 1]
	other_sum_val = sum(A) - max_val
	return max_val - other_sum_val + 1

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


_ = int(input())
l = list(map(int, input().split()))
print((max(l) << 1) + 1 - sum(l))


n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
ll = l[-1]
l_sum = sum(l) - ll
print(ll - l_sum + 1)


n = int(input())
l = list(map(int, input().split()))
p = max(l)
sum = 0
for i in l:
	sum += i
print(2 * p - sum + 1)


n = int(input())
tab = [int(i) for i in input().split()]
tab.sort()
x = tab[n - 1]
tab.pop()
y = x - sum(tab) + 1
print(y)


n = int(input())
arr = [*map(int, input().split(' '))]
print(max(arr) * 2 - sum(arr) + 1)


import math
n = int(input())
l = sorted(list(map(int, input().split())))
ans = l[-1] - l[0]
for i in range(1, n - 1):
	if ans > 0:
		ans -= l[i]
	else:
		ans += l[i]
print(abs(ans) + 1)


n = int(input())
k = 0
maxi = 0
index = 0
a = list(map(int, input().split(' ')))
for i in range(n):
	if a[i] > maxi:
		maxi = a[i]
		index = i
for i in range(n):
	if index != i:
		maxi -= a[i]
print(maxi + 1)


n = input()
l = sorted(map(int, input().split()))
m = sum(l[:-1])
print(l[-1] + 1 - m)


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


n = int(input())
a = list(map(int, input().split()))
m = max(a)
s = sum(a) - m
print(m - s + 1)


n = int(input())
l = list(map(int, input().split()))
print(2 * max(l) - sum(l) + 1)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
su = sum(l[:-1])
print(abs(l[-1] - su) + 1)


n = int(input())
l = list(map(int, input().split()))
m = max(l)
h = l.index(m)
x = sum(l[0:h]) + +sum(l[h + 1:n + 1])
print(abs(m - x + 1))


I = input
I()
a = list(map(int, I().split()))
print(2 * max(a) - sum(a) + 1)


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


input()
ml = sorted([int(x) for x in input().split()])
print(ml[-1] - sum(ml[:-1]) + 1)


import sys
input = sys.stdin.readline
from collections import *
n = int(input())
l = list(map(int, input().split()))
l.sort()
s = sum(l)
a = 0
ans = 10 ** 18
for li in l:
	a += li
	b = s - a
	ans = min(ans, abs(a - b) + 1)
print(ans)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def dist(x, y, c, d):
	return mt.sqrt((x - c) ** 2 + (y - d) ** 2)

def circle(x1, y1, x2, y2, r1, r2):
	distSq = ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5
	if distSq + r2 <= r1:
		return True
	else:
		return False
n = I()
l = L()
l.sort(reverse=True)
a = l[0]
b = sum(l[1:])
print(max(a, b) - min(a, b) + 1)


a = int(input())
t = list(map(int, input().split()))
f = [max(t), sum(t) - max(t)]
print(max(f) - min(f) + 1)


import sys
from bisect import bisect_left

def second():
	inp = sys.stdin.readline()
	n = int(inp)
	inp = []
	inp = sys.stdin.readline().split(' ')
	inp = list(map(int, inp))
	inp.sort()
	s = sum(inp)
	hl = 0
	count = 0
	while hl < s and count < n - 1:
		hl += inp[0]
		s -= inp[0]
		inp.pop(0)
		count += 1
	if hl > s:
		print(hl - s - 1)
	else:
		print(s - hl + 1)
second()


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


input()
X = list(map(int, input().split()))
print(abs(sum(X) - 2 * max(X)) + 1)


from sys import stdin as Si
from math import floor as F
from collections import defaultdict as dt
from operator import itemgetter as ig
from math import pi
n = int(Si.readline())
rods = list(map(int, Si.readline().split()))

def golden(R):
	M = max(R)
	if R.count(M) == len(rods):
		print(1)
	else:
		S = [i for i in R if i != M]
		Sum = sum(S)
		if Sum <= M:
			print(M - Sum + 1)
		else:
			golden(S)
golden(rods)


n = int(input())
a = list(map(int, input().split()))
x = max(a)
print(x - (sum(a) - x) + 1)


import math
import collections

def solve(n, l):
	return max(l) - (sum(l) - max(l)) + 1
n = int(input())
l = [int(s) for s in input().split()]
result = solve(n, l)
print(result)


n = int(input())
l = sorted([int(i) for i in input().split()])
if max(l) % 2 == 0:
	SUM_SR = (max(l) + 1) // 2 * 2 + 1
else:
	SUM_SR = (max(l) + 1) // 2 * 2
i = 0
while i < len(l) - 1:
	SUM_SR -= l[i]
	i += 1
print(SUM_SR)


n = int(input())
A = list(map(int, input().split()))
S = sum(A)
M = max(A)
S -= M
print(M - S + 1)


from sys import *
inp = lambda : stdin.readline()
import math

def main():
	(n, l) = (int(inp()), list(map(int, inp().split())))
	a = 2 * max(l) - sum(l) + 1
	print(a)
main()


n = int(input())
arr = []
sum = 0
for x in input().split():
	arr.append(int(x))
	sum += int(x)
ln = 0
for i in range(0, len(arr)):
	if ln < arr[i]:
		ln = arr[i]
sn = sum - ln
print(str(ln - sn + 1))


n = int(input())
a = list(map(int, input().split()))
m = max(a)
s = 0
for x in a:
	s += x
s -= m
ans = m - s + 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
res = max(l) - (sum(l) - max(l)) + 1
print(res)


def solve():
	N = int(input())
	L = list(map(int, input().split()))
	ma = max(L)
	re = sum(L) - ma
	ans = ma - re + 1
	print(ans)
solve()


import sys
import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

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

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True
n = ii()
a = sorted(li())
print(a[-1] - sum(a[:-1]) + 1)


n = int(input())
l = list(map(int, input().split()))
required_length = max(l) - (sum(l) - max(l)) + 1
print(required_length)


n = int(input())
L = [int(c) for c in input().split()]
mx = max(L)
side = sum(L) - mx
ans = mx - side + 1
print(ans)


kq = int(input())
luv = list(map(int, input().split(' ')))
luv.sort()
luv.reverse()
print(max(0, luv[0] - sum(luv[1:]) + 1))


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = a.pop()
print(b - sum(a) + 1)


n = int(input())
l = input().split()
llen = len(l)
for i in range(llen):
	l[i] = int(l[i])
print(2 * max(l) + 1 - sum(l))


n = int(input())
s = 0
rods = input().split()
for i in range(0, n):
	rods[i] = int(rods[i])
rods = sorted(rods)
for i in range(n - 2, -1, -1):
	s = s + rods[i]
print(rods[n - 1] - s + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
p = a[0]
q = sum(a[1:])
r = p - q + 1
print(r)


import copy

def convex(val, count):
	val.sort(reverse=True)
	sumA = 0
	sortedVal = copy.deepcopy(val)
	sortedVal.sort(reverse=True)
	cap = 1
	accend = [0 for i in range(count)]
	accend[count - 1] = val[count - 1]
	for k in range(1, count):
		accend[count - 1 - k] = val[count - 1 - k] + accend[count - k]
	for i in range(1, count):
		sumA = sum(sortedVal[:i])
		if sumA >= accend[i]:
			minlength = sumA - accend[i] + 1
			break
	print(minlength)

def main():
	count = int(input())
	if count <= 10 ** 5:
		stdata = input()
		data = list(map(int, stdata.split()))
		convex(data, count)
main()


n = int(input())
mas = [int(x) for x in input().split()]
z = max(mas)
mas.remove(z)
summa = 0
for i in mas:
	summa = summa + i
print(z - summa + 1)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
n = ii()
l = li()
d = sum(l) - max(l)
print(max(l) + 1 - d)


(_, edges) = (input(), list(map(int, input().split())))
longest = max(edges)
others = sum(edges) - longest
print(longest - others + 1)


n = int(input())
list = [int(i) for i in input().split()]
large = max(list)
some = sum(list) - large
print(large - some + 1)


n = int(input())
rods = []
s = input()
for l in s.split():
	rods.append(int(l))
rods = sorted(rods)
print(rods[-1] - sum(rods[:-1]) + 1)


n = int(input())
l = sorted(list(map(int, input().split())))
print(l[n - 1] - sum(l[:-1]) + 1)


n = int(input())
l = map(int, input().split())
l = sorted(l)
kid = l[:-2]
mm = l[-2:]
for k in kid:
	mm[0] += k
	mm.sort()
print(mm[1] - mm[0] + 1)


try:
	while True:
		n = int(input())
		a = list(map(int, input().split()))
		m = max(a)
		print((m << 1) - sum(a) + 1)
except EOFError:
	pass


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
k = sum(l) / 3
ans = [0, 0, 0]
j = 0
for i in l:
	ans[j] += i
	if ans[j] >= k:
		j += 1
ans.sort(reverse=True)
print(ans[0] - ans[1] + 1 - ans[2])


n = int(input())
l = [int(x) for x in input().split()]
print(max(l) - (sum(l) - max(l)) + 1)


n = int(input())
a = list(map(int, input().split()))
z = max(a)
ans = z - (sum(a) - z) + 1
if ans < 0:
	ans = 0
print(ans)


n = int(input())
s = [int(i) for i in input().split()]
a = max(s)
b = min(s)
c = sum(s)
print(a - b - (c - a - b) + 1)


mas = list(map(int, input().split()))
t = mas[0]
mas = list(map(int, input().split()))
s = 0
for i in mas:
	s += i
mas.sort()
print(2 * mas[-1] - s + 1)


def main():
	input()
	l = list(map(int, input().split()))
	print(max(l) * 2 - sum(l) + 1)
main()


n = int(input())
l = sorted(list(map(int, input().split())))
S = sum(l)
u = 0
s = 0
for i in l:
	u += i
	if abs(u - S / 2) < abs(s - S / 2):
		s = u
print(int(abs(s + s - S)) + 1)


n = int(input())
li = list(map(int, input().split()))
li.sort()
n3 = sum(li)
n2 = n3 // 2
temp = 0
temp2 = 0
for num in li:
	temp += num
	if temp > n2:
		temp2 = abs(temp - (n3 - temp))
		temp -= num
		temp2 = min(temp2, abs(temp - (n3 - temp)))
print(temp2 + 1)


n = int(input())
A = [int(x) for x in input().split()]
print(2 * max(A) - sum(A) + 1)


from itertools import *
from collections import Counter
from operator import *
from functools import reduce
import re, math
from pprint import pprint
from fractions import gcd

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
N = int(input())
A = list(reversed(sorted(inputarray())))
diff = A[0] - sum(A[1:]) + 1
print(diff)


__author__ = 'Andrey'
n = int(input())
(m, s1) = (lambda x: (max(x), sum(x)))(list(map(int, input().split())))
s = s1 - m
print(m - s + 1)


n = int(input())
l = list(map(int, input().split()))
s = 0
for i in range(n):
	s += l[i]
m = max(l)
s1 = s - m
dlina = m + 1 - s1
print(dlina)


n = int(input())
l = sorted(map(int, input().split()))
mi = l[-2]
ma = l[-1]
for i in range(n - 2):
	if mi < ma:
		mi += l[i]
	else:
		ma += l[i]
print(abs(ma - mi) + 1)


n = int(input())
a = [int(i) for i in input().split()]
m = max(a)
s = sum(a)
print(2 * m - s + 1)


input()
(*L, x) = sorted(map(int, input().split()))
print(max(0, x - sum(L) + 1))


from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
n = int(input())
lis = list(map(int, input().split(' ')))
max_li = max(lis)
total = sum(lis) - max_li
print(max_li - total + 1)


n = int(input())
l = list(map(int, input().split()))
total = sum(l)
gap = 0
for rod in l:
	gap = max(gap, rod - (total - rod))
print(gap + 1)


n = int(input(''))
arr = input('').split(' ')
for i in range(n):
	arr[i] = int(arr[i])
arr.sort(reverse=True)
tmp = 0
for i in range(1, n):
	tmp += arr[i]
print(max(0, arr[0] + 1 - tmp))