Clarke and math

Time Limit: 2500ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5628
64-bit integer IO format: %I64d      Java class name: Main

Description

Clarke is a patient with multiple personality disorder. One day, he turned into a mathematician, did a research on interesting things.
Suddenly he found a interesting formula. Given $f(i), 1 \le i \le n$, calculate
$\displaystyle g(i) = \sum_{i_1 \mid i} \sum_{i_2 \mid i_1} \sum_{i_3 \mid i_2} \cdots \sum_{i_k \mid i_{k-1}} f(i_k) \text{ mod } 1000000007 \quad (1 \le i \le n)$

Input

The first line contains an integer $T(1 \le T \le 5)$, the number of test cases.
For each test case, the first line contains two integers $n, k(1 \le n, k \le 100000)$.
The second line contains $n$ integers, the $i$th integer denotes $f(i), 0 \le f(i) < 10^9+7$.

Output

For each test case, print a line contained $n$ integers, the $i$th integer represents $g(i)$.

Sample Input

2
6 2
2 3 3 3 3 3
23 3
2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

Sample Output

2 7 7 15 7 23
2 9 9 24 9 39 9 50 24 39 9 102 9 39 39 90 9 102 9 102 39 39 9

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .