P26665 [AtCoder] Movie Theater
普及
题目描述

Problem Description

$ N $ people are seated in a row of $ M $ seats.

It is known that for the $i(1 \leq i \leq N)$th person, there are at least $ A_i $ empty seats continuously on both sides of their seat. Determine the minimum value of $ M $.

The $ N $ people are not necessarily seated in this order. (13:38)

Input Format

None

Output Format

Output the minimum number of seats $ M $ that can be considered. End your answer with a newline.

Sample Input and Output

Sample Input #1

3
2 3 2

Sample Output #1

13

Sample Input #2

5
6 6 9 7 4

Sample Output #2

46

Sample Input #3

10
10 6 6 10 3 8 8 9 4 2

Sample Output #3

86

Notes/Hints

Scoring

There are no partial points for this problem. Correctly solving all test cases will award 100 points.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 2 3 2
样例输出
13