Cman and Candies

All submissions for this problem are available.
Cman doesn’t love bitwise operations anymore. He loves Alisha. Alisha is cute :). Cman know that most of all Alisha loves candies, that's why he bought N candies for her. Cost of ith candy is C[i]. Happiness associated with ith candy is defined as :
A[i]=C[i] if i=1
A[i]=(Σ C[i]  C[j] for j = 1 to i  1) % 10^9+7 if 2<=i<=N
Cman wants to know the happiness associated with each candy. Help him to find solution to this problem.
Note: X is same as absolute value of X
Input
 First line of input consists of a single integer T representing number of test cases.
 First line of each test case contains a space separated integer N.
 Next line consist of N space separated integer C[1], C[2], . . , C[N] denoting cost of candies.
Output

For each test case print a single line containing N space separated integers A[1], A[2], . . , A[N] where A[i] denotes happiness of ith candy.
Constraints
 1 ≤ T ≤ 10
 1 ≤ N ≤ 10^{5}
 1 ≤ C[i] ≤ 10^{5}
Note: Order of candies should remain same i.e A[i] denotes happiness for ith candy in the given array having cost C[i]
Example
Input: 1 3 1 2 3 Output: 1 1 3
Author:  ashish1610 
Tags  ashish1610 
Date Added:  24102015 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 