You have opened a new betting business. You have decided that you will accept bets on the upcoming Cricket World Cup tournament. teams take part in the tournament. Only one team can win the tournament.
To conduct your business, you can choose positive real values, before the tournament. People can pick their favorite team and make a bet on them winning. If they pick the th team and bet dollars, they are paid back dollars if their team wins. However, if their team loses they lose all their money. For fairness, it is required that .
Your profit is the total amount of dollars bet minus the amount of dollars paid back. Since you want to maximize your profit you want to minimize the expected amount of dollars you have to pay back. Through supernatural powers, you have deduced that the th team will win the tournament with probability and dollars will be bet on them. You want to find optimal values of such that the expected amount of dollars you pay back is minimized.
The first line contains --- the number of teams in the tournament.
The next line contains integers, .
The next line contains integers, .
Let . The probability that team wins can be calculated as
On the first line print two real numbers. The first number is the total amount of dollars bet on all teams. The second number is the minimum expected amount of dollars you have to pay back.
On the next line print real numbers, optimal values of that achieve the minimum expenditure. It can be proven that the optimal values are unique.
Your answer will be considered correct if its absolute or relative error does not exceed .
Input | Output |
---|---|
2 6 4 6 4 | 10 10 0.6 0.4 |
Input | Output |
---|---|
2 1 9 9 1 | 10 3.6 0.5 0.5 |
Input | Output |
---|---|
3 7 3 2 4 2 9 | 12.000000000000 9.573830741716 0.441560802067 0.204402932913 0.354036265021 |