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:  ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC 
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. 