CF1043A.Elections

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Elections

Awruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are nn students in the school. Each student has exactly kk votes and is obligated to use all of them. So Awruk knows that if a person gives aia_i votes for Elodreip, than he will get exactly kaik - a_i votes from this person. Of course 0kai0 \le k - a_i holds.

Awruk knows that if he loses his life is over. He has been speaking a lot with his friends and now he knows a1,a2,,ana_1, a_2, \dots, a_n — how many votes for Elodreip each student wants to give. Now he wants to change the number kk to win the elections. Of course he knows that bigger kk means bigger chance that somebody may notice that he has changed something and then he will be disqualified.

So, Awruk knows a1,a2,,ana_1, a_2, \dots, a_n — how many votes each student will give to his opponent. Help him select the smallest winning number kk. In order to win, Awruk needs to get strictly more votes than Elodreip.

Input

The first line contains integer nn (1n1001 \le n \le 100) — the number of students in the school.

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1001 \leq a_i \leq 100) — the number of votes each student gives to Elodreip.

Output

Output the smallest integer kk (kmaxaik \ge \max a_i) which gives Awruk the victory. In order to win, Awruk needs to get strictly more votes than Elodreip.

Note

In the first example, Elodreip gets 1+1+1+5+1=91 + 1 + 1 + 5 + 1 = 9 votes. The smallest possible kk is 55 (it surely can't be less due to the fourth person), and it leads to 4+4+4+0+4=164 + 4 + 4 + 0 + 4 = 16 votes for Awruk, which is enough to win.

In the second example, Elodreip gets 1111 votes. If k=4k = 4, Awruk gets 99 votes and loses to Elodreip.

Samples

5
1 1 1 5 1
5
5
2 2 3 2 2
5

在线编程 IDE

建议全屏模式获得最佳体验