**C. Little Artem and Random Variable**
Little Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them.

Consider, dices. When thrown all dice shows some integer from 1 to *n* inclusive. For each dice the probability of each outcome are given (of course, their sum is 1), and different dices could have Diffe Rent probability distributions.

We throw both dices simultaneously and then calculate values*Max*(*a*,*b*) and*min*(*a*,*b*), where*a*is equal to the outcome of the first dice, while*b*is equal to the outcome of the second dice. You don ' t know the probability distributions for particular values in each dice, but you know the probability distribution S for *Max*(*a*, *b*) and *min*(*a*, *b*). That's, for each *x* from 1 to *n* know the probability that*max*(*a< /c15>, **b*) would is equal to *x* and the probability that *min*(*a*, *b *) would is equal to *x.* Find any valid probability distribution for values on the dices. It's guaranteed that's the input data is consistent, that's, at least one solution exists.

**Input**
First line contains the integer *n* (1≤ *n* ≤100)-the number of different values for both di CES.

Second line contains a array consisting of *n* Real values with up to 8 digits after the decimal point-prob Ability distribution for*Max*(*a*, *b*), the *i*-th of these values equals to the P Robability that *Max*(*a*, *b*) = *I.* It's guaranteed the sum of these values for one dice is 1. The third line contains the description of the distribution *min*(*a*, *b*) in the same fo Rmat.

**Output**
Output of descriptions of the probability distribution for a in the first line and for *b* on the Second line.

The answer is considered correct if each value of Max (*a*, *b*) and min (*a*, *b*) Probability distribution values does not differ by + than -6 from ones given in input. Also, probabilities should is non-negative and their sums should differ from 1 to no more than -6.

**Examples**
**input**
2

0.25 0.75

0.75 0.25

**Output**

**Test Instructions:**Two identical dice n Faces (1-n) and give you Max (A, B) =i and Min (A, B) the probability of =i you to ask a A, B, respectively is the probability of IThe

**following:**Set the probability prefix of the first face of the dice and q[i], suffix p[i] then we can get q[i]*p[i] = a[i] prefix and (1-q[i]) * (1-p[i]) = b[i+1] The suffix and merge simplified can get p[i] + q[i] = 1+a[i ]-b[i+1]; Just use these three formulas.

#include <iostream>#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>using namespacestd;Const intN = 1e5+Ten, M = 1e3+Ten, mod =1000000, INF = 1e9+ +; typedefLong Longll;DoubleA[n],b[n],p[n],q[n];intN;intMain () {scanf ("%d",&N); for(intI=1; i<=n;i++) scanf ("%LF",&A[i]); for(intj=1; j<=n;j++) scanf ("%LF",&B[j]); for(intI=1; i<=n;i++) A[i] = a[i-1] +A[i]; for(inti=n;i>=1; i--) B[i] = B[i] + b[i+1]; for(intI=1; i<=n;i++) { DoubleB = b[i+1]-A[i]-1; Doubledd = sqrt (max (b*b-4*a[i],0.)); P[i]= (-B+DD)/2; Q[i]= (-B-DD)/2; } for(intI=1; i<=n;i++) cout<<q[i]-q[i-1]<<" "; cout<<Endl; for(intI=1; i<=n;i++) cout<<p[i]-p[i-1]<<" "; return 0;}

Codeforces Round #348 (VK Cup Round 2, Div. 1 Edition) c. Little Artem and Random Variable Math