#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 nn and xix_i 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 mthm_{th} power items as i=1nxim\sum_{i=1}^nx_i^m

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 TT, 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 [50000,50000][-50000,50000].

Output

One line for each test case contains three integers indicating the answer, which are sum of the cross items with kk in the range 2k42\leq k\leq 4 separated with a blank.

Samples

1
10 30 100 354
35 50 24

Resources

The 7th UESTC Programming Contest Final