Problem A
Fair Bandwidth Sharing
Dreaming of revolutionizing the tech industry and making the world a better place, Ging has recently moved to Silicon Valley to found his own startup, Katbook.
Katbook allows users to download cat pictures. Katbook is
capable of transferring
There are
However, because of infrastructure limitations, the
bandwidth for the
You are newly hired by Ging as a network engineer at
Katbook. Your first task is to find the most ‘fair’ bandwidth
allocation satisfying the above constraints. More formally, let
-
, -
, -
Let
( is the ‘fair share’ bandwidth, if there was no constraints regarding and ), the value should be as small as possible.
Input
The first line of input contains
In the next
It is guaranteed that there exists at least one valid solution.
It can be shown that under these constraints, the solution is unique.
Output
Output
Formally, for each line, let your answer be
Explanation of Sample input
In the first sample, each cat species has its ‘fair share’
of
In the second sample, note that the cat species
Sample Input 1 | Sample Output 1 |
---|---|
3 10 0 10 1 0 10 1 0 10 1 |
3.33333333 3.33333333 3.33333333 |
Sample Input 2 | Sample Output 2 |
---|---|
3 10 0 1 1000 2 8 2 2 8 1 |
1.00000000 6.00000000 3.00000000 |