#Lutece0109. Easy Math
Easy Math
Migrated from Lutece 109 Easy Math
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
The following equation will be constantly valid no matter what values the variable and have. $\sum_{1\leq i, j\leq n, i\neq j} x_ix_j = (\sum_{i=1}^{n}x_i)^2-\sum_{i=1}^{n}x_i^2$ which means, we could yield the sum of cross items product from sum and sum of square. Now the challenge is to calculate the sum cross items product with given sum, sum of squares, sum of cubes and sum of fourth powers.
Here we have to define of sum of power items as
In addition, sum of cross items product is defined as: $\sum_{\forall 1\leq m<l\leq k\Rightarrow 1\leq i_m,i_l\leq n \& i_m\neq i_l}x_{i_1}x_{i_2}\cdots x_{i_k}$
Input
The first line of the input contains one integer , which indicate the number of test cases. Each test case contains four integers indicating sum, sum of squares, sum of cubes and sum of fourth power in order, and each is in the range of .
Output
One line for each test case contains three integers indicating the answer, which are sum of the cross items with in the range separated with a blank.
Samples
1
10 30 100 354
35 50 24
Resources
The 7th UESTC Programming Contest Final