QOJ.ac

QOJ

実行時間制限: 3 s メモリ制限: 512 MB 満点: 100

#4646. Photos

統計

Given a sequence of $N$ integers $A = (A_1, A_2, \dots, A_N)$.

You can perform the following operation any number of times: Choose an index $i$ such that $1 \le i < N$ and $A_i > 0$, then replace $A_i$ with $A_i - 1$ and $A_{i+1}$ with $A_{i+1} + 1$.

Find the maximum possible value of the minimum element in the sequence $A$ after performing the operation any number of times.

Input

The first line contains an integer $N$. The second line contains $N$ integers $A_1, A_2, \dots, A_N$.

Output

Output the maximum possible value of the minimum element in the sequence.

Constraints

  • $2 \le N \le 2 \times 10^5$
  • $0 \le A_i \le 10^9$

Examples

Input 1

3
2 2 2

Output 1

2

Input 2

3
1 2 3

Output 2

2

Input 3

5
10 0 0 0 0

Output 3

0

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.