Time limit: 0.05s
Memory limit: 2MB
Input: padurar.in
Output: padurar.out
Task
Nicholas works at a sawmill and needs to prepare a package of exactly identical planks, each having length . The warehouse contains logs with lengths .
Nicholas can cut several planks of length from a single log, but each cut wears out his saw. He has established the following rules:
- One or more planks of length can be cut from any log. Any piece of wood remaining that is shorter than is considered waste.
- Each cut consumes 1 unit of the saw's total durability .
- Example: If a log has length and planks of length are needed, one single cut is made in the middle to obtain planks (cost unit).
- Example: If a log has length and planks of length are needed, two cuts are made (at distance and ) to obtain planks, the remaining being waste (cost units).
Help Nicholas find the maximum length that the planks can have, without exceeding the saw's durability .
Input Data
The first line contains three integers , and .
The second line contains integers representing the log lengths .
Output Data
Print a single natural number representing the maximum length . If it is impossible to obtain planks, print .
Constraints and Clarifications
- For 20% of the score:
- For another 30% of the score:
Example
padurar.in
2 4 3
10 12
padurar.out
5
Explanation
For :
- From the first log (), planks are obtained using cut.
- From the second log (), planks are obtained using cuts.
Total: planks and cuts. The conditions are met.
If we chose , we would obtain only planks, so is the maximum.