Betting Business

Limits 1s, 512 MB

You have opened a new betting business. You have decided that you will accept bets on the upcoming Cricket World Cup tournament. nn teams take part in the tournament. Only one team can win the tournament.

To conduct your business, you can choose nn positive real values, q1,q2,,qnq_1, q_2, \ldots, q_n before the tournament. People can pick their favorite team and make a bet on them winning. If they pick the iith team and bet xx dollars, they are paid back x/qix/q_i dollars if their team wins. However, if their team loses they lose all their money. For fairness, it is required that q1+q2++qn1q_1 + q_2 + \cdots + q_n \leq 1.

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 iith team will win the tournament with probability pip_i and BiB_i dollars will be bet on them. You want to find optimal values of q1,q2,,qnq_1, q_2, \ldots, q_n such that the expected amount of dollars you pay back is minimized.

Input

The first line contains nn (1n1000)(1 \leq n \leq 1000) --- the number of teams in the tournament.

The next line contains nn integers, B1,B2,BnB_1, B_2, \ldots B_n (1Bi1000)(1 \leq B_i \leq 1000).

The next line contains nn integers, c1,c2,cnc_1, c_2, \ldots c_n (1ci1000)(1 \leq c_i \leq 1000).

Let C=j=1ncjC = \sum_{j=1}^n{c_j}. The probability that team ii wins can be calculated as pi=ciCp_i = {c_i \over C}

Output

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 nn real numbers, optimal values of q1,q2,,qnq_1, q_2, \ldots, q_n 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 10610^{-6}.

Samples

InputOutput
2
6 4
6 4
10 10
0.6 0.4
InputOutput
2
1 9
9 1
10 3.6
0.5 0.5
InputOutput
3
7 3 2
4 2 9
12.000000000000 9.573830741716
0.441560802067 0.204402932913 0.354036265021