#P1801F. Another n-dimensional chocolate bar
Another n-dimensional chocolate bar
No submission language available for this problem.
Description
Vasya and his friends want to cut a chocolate bar to get at least pieces, while Vasya wants to maximize the volume of the smallest of them. It is possible to cut the chocolate bar only at the junction of the lobules, and each incision must pass through the entire chocolate bar along some hyperplane involved in the formation of lobules. Only after making all the cuts, Vasya disassembles the chocolate into pieces.
More formally, Vasya wants to choose the numbers () — the number of parts into which Vasya will cut the chocolate bar along each dimension. The condition must be met to get at least pieces after all cuts. It can be noted that with optimal cutting with such parameters, the minimum piece will contain slices, and its volume will be equal to .
Vasya wants to get the maximum possible value of the volume of the minimum piece multiplied by , that is, he wants to maximize the number of . Help him with this.
The first line contains two integers and , — the dimension of the chocolate bar, and how many parts it needs to be divided into.
The second line contains integers — the number of pieces on which the chocolate is placed along each of the dimensions.
Print one number — the maximum possible volume of the smallest of the obtained pieces, multiplied by , with an absolute or relative error of no more than .
If it is impossible to cut a chocolate bar into at least pieces under the given restrictions, output .
Input
The first line contains two integers and , — the dimension of the chocolate bar, and how many parts it needs to be divided into.
The second line contains integers — the number of pieces on which the chocolate is placed along each of the dimensions.
Output
Print one number — the maximum possible volume of the smallest of the obtained pieces, multiplied by , with an absolute or relative error of no more than .
If it is impossible to cut a chocolate bar into at least pieces under the given restrictions, output .
Note
In the first example, a one – dimensional chocolate bar can be divided as follows:
Then the answer will be
In the second example, the chocolate bar can be cut as follows:
Then the answer will be
In the third example, the chocolate bar can be cut as follows:
Then the answer will be