Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Coat of Anticubism

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputAs 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 .

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}.

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/22/2019 08:04:33 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|