Elon Musk is optimizing an assembly line in one of his factories and he needs your help to find an assignment of humanoid robots to stations that maximizes throughput (number of work units processed per hour).
0.60 There are a total of identical humanoid robots to be distributed among workstations (numbered 1 to ) of the assembly line. At each station , robots collect work units from the output storage of station , perform some station-specific operation (such as welding, painting...), and then place the processed work units on the output storage of station , to be collected by robots from station . Each robot at station can process work units per hour. Assume that robots at station 1 collect work units from a warehouse with unlimited supply, and that the output of station can be consumed at an arbitrarily high rate.
0.40
Can you find the maximum throughput that can be achieved by distributing the robots among the stations optimally?
Each case starts with and . Follow the integers , all between 1 and . You can assume and .
For every case, print the maximum possible throughput of the assembly line.
Input
4 2 10 10 3 3 4 1 12 17 2 42 69 1000000000 4 500000000 42 1000000000 23
Output
20 1 420 14861537791