You've got an array a, consisting of n integers. The array elements are indexed from 1 to n. Let's determine a two step operation like that:

  1. First we build by the array a an array s of partial sums, consisting of n elements. Element number i (1 ≤ i ≤ n) of array s equals <image>. The operation x mod y means that we take the remainder of the division of number x by number y. 
  2. Then we write the contents of the array s to the array a. Element number i (1 ≤ i ≤ n) of the array s becomes the i-th element of the array a (ai = si). 



You task is to find array a after exactly k described operations are applied.

Input

The first line contains two space-separated integers n and k (1 ≤ n ≤ 2000, 0 ≤ k ≤ 109). The next line contains n space-separated integers a1, a2, ..., an — elements of the array a (0 ≤ ai ≤ 109).

Output

Print n integers — elements of the array a after the operations are applied to it. Print the elements in the order of increasing of their indexes in the array a. Separate the printed numbers by spaces.

Examples

Input

3 1
1 2 3


Output

1 3 6


Input

5 0
3 14 15 92 6


Output

3 14 15 92 6
#include <bits/stdc++.h>
using namespace std;
int t, n, k;
int a, b, c;
vector<pair<int, int> > E[102];
int nodes;
int izq[202], der[202], C[202];
int creaArbolBinario(int node, int idx, int p) {
  if (idx >= E[node].size()) return -1;
  int val = nodes++;
  izq[val] = -1;
  der[val] = -1;
  C[val] = 0;
  if (E[node][idx].first == p) {
    idx++;
    if (idx >= E[node].size()) return val;
  }
  int v = E[node][idx].first;
  izq[val] = creaArbolBinario(v, 0, node);
  der[val] = creaArbolBinario(node, idx + 1, p);
  C[val] = E[node][idx].second;
  return val;
}
int DP[202][102][4];
bool vis[202][102][4];
int f(int i, int k, int a) {
  if (i == -1 || k < 0) return 0;
  if (!vis[i][k][a]) {
    vis[i][k][a] = true;
    DP[i][k][a] = 0;
    int r;
    if (a == 0) {
      for (r = 0; r <= k; r++)
        DP[i][k][a] = max(f(izq[i], r, 2) + f(der[i], k - r, 0), DP[i][k][a]);
    }
    if (a == 1) {
      for (r = 0; r <= k; r++)
        DP[i][k][a] =
            max(f(izq[i], r, 1) + f(der[i], k - r, 0) + C[i], DP[i][k][a]);
      for (r = 0; r <= k; r++)
        DP[i][k][a] = max(f(izq[i], r, 2) + f(der[i], k - r, 1), DP[i][k][a]);
      DP[i][k][a] = max(DP[i][k][a], f(i, k, 0));
    }
    if (a == 2) {
      for (r = 0; r <= k - 1; r++)
        DP[i][k][a] =
            max(f(izq[i], r, 1) + f(der[i], k - 1 - r, 1) + C[i], DP[i][k][a]);
      for (r = 0; r <= k; r++)
        DP[i][k][a] = max(f(izq[i], r, 2) + f(der[i], k - r, 2), DP[i][k][a]);
      DP[i][k][a] = max(DP[i][k][a], f(i, k, 0));
    }
  }
  return DP[i][k][a];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  for (; t; t--) {
    cin >> n >> k;
    for (int i = 1; i < n; i++) {
      cin >> a >> b >> c;
      E[a].push_back(make_pair(b, c));
      E[b].push_back(make_pair(a, c));
    }
    creaArbolBinario(1, 0, 0);
    cout << f(0, k, 2) << "\n";
    fill(izq, izq + nodes + 1, 0);
    fill(der, der + nodes + 1, 0);
    fill(C, C + nodes + 1, 0);
    for (int i = 1; i <= n; i++) E[i].clear();
    for (int i = 0; i <= nodes; i++)
      for (int j = 0; j <= k; j++)
        for (int a = 0; a <= 2; a++) DP[i][j][a] = vis[i][j][a] = 0;
    nodes = 0;
  }
  return 0;
}
