cswork / OAOpen practice workspace

AirbnbOA #2

Donut Challenge

Estimated MediumJudge-ready

Topics (AI-labelled)Binary Search

In each unit of time you can eat from only one box/pile, at most d items; eating fewer than d still uses a full unit of time, and leftover capacity cannot carry over to the next box/pile. Find the minimum positive integer speed that finishes everything within the deadline.

Input

The first line contains n, the second line contains n quantities, and the third line contains the deadline h. The original numeric upper bounds are missing; this site adds 1≤n≤200000, quantities in 1..10^9, and h≤10^18. The original guarantees feasibility; on this site n≤h.

Output

Output a single integer answer.

Example 1

Input:

4
4 9 11 17
8

Output:

6

Example 2

Input:

4
3 6 7 11
8

Output:

4

Example 3

Input:

2
2 2
2

Output:

2

Example notes

The outputs of the three public examples are, in order: 6; 4; 2. Verified by independent enumeration or direct simulation.

Editorial

Loading solution…