#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native")
using namespace std;
long long gcd(long long i, long long j) {
  if (j == 0)
    return i;
  else
    return gcd(j, i % j);
}
template <typename T>
inline T getint() {
  T val = 0;
  char c;
  bool neg = false;
  while ((c = getchar()) && !(c >= '0' && c <= '9')) {
    neg |= c == '-';
  }
  do {
    val = (val * 10) + c - '0';
  } while ((c = getchar()) && (c >= '0' && c <= '9'));
  return val * (neg ? -1 : 1);
}
const long long INF = 1e18 + 100;
const int mod = 1000000007;
const long double eps = 1e-10, pi = acosl(-1);
const long long maxN = 200010, maxT = 25000, A = 179, mid = 150;
mt19937 mt_rand(time(0));
long long bp(long long et, long long b) {
  b %= mod - 1;
  long long res = 1;
  for (int i = 30; i >= 0; --i) {
    res = (res * res) % mod;
    if ((b & (1 << i)) != 0) res = (res * et) % mod;
  }
  return res;
}
void panic() {
  cout << "-1\n";
  exit(0);
}
vector<vector<int>> g;
vector<int> cnt;
void dfs(int v, int d, int p = -1) {
  ++cnt[d];
  for (auto x : g[v]) {
    if (x == p) continue;
    dfs(x, d + 1, v);
  }
}
void solve() {
  int n, k;
  cin >> n >> k;
  g.assign(n, vector<int>());
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  if (k == 2) {
    cout << n * (n - 1) / 2 << "\n";
    return;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    vector<vector<int>> dp(n, vector<int>(k + 1));
    for (int i = 0; i < n; ++i) dp[i][0] = 1;
    for (auto x : g[i]) {
      cnt.assign(n, 0);
      dfs(x, 1, i);
      for (int d = 0; d < n; ++d) {
        if (cnt[d] == 0) continue;
        for (int j = k - 1; j >= 0; --j) {
          dp[d][j + 1] = (dp[d][j + 1] + (long long)cnt[d] * dp[d][j]) % mod;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      ans = (ans + dp[i][k]) % mod;
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

A tree is an undirected connected graph without cycles.

You are given a tree of n vertices. Find the number of ways to choose exactly k vertices in this tree (i. e. a k-element subset of vertices) so that all pairwise distances between the selected vertices are equal (in other words, there exists an integer c such that for all u, v (u ≠ v, u, v are in selected vertices) d_{u,v}=c, where d_{u,v} is the distance from u to v).

Since the answer may be very large, you need to output it modulo 10^9 + 7.

Input

The first line contains one integer t (1 ≤ t ≤ 10) — the number of test cases. Then t test cases follow.

Each test case is preceded by an empty line.

Each test case consists of several lines. The first line of the test case contains two integers n and k (2 ≤ k ≤ n ≤ 100) — the number of vertices in the tree and the number of vertices to be selected, respectively. Then n - 1 lines follow, each of them contains two integers u and v (1 ≤ u, v ≤ n, u ≠ v) which describe a pair of vertices connected by an edge. It is guaranteed that the given graph is a tree and has no loops or multiple edges.

Output

For each test case output in a separate line a single integer — the number of ways to select exactly k vertices so that for all pairs of selected vertices the distances between the vertices in the pairs are equal, modulo 10^9 + 7 (in other words, print the remainder when divided by 1000000007).

Example

Input


3

4 2
1 2
2 3
2 4

3 3
1 2
2 3

5 3
1 2
2 3
2 4
4 5


Output


6
0
1

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native")
using namespace std;
long long gcd(long long i, long long j) {
  if (j == 0)
    return i;
  else
    return gcd(j, i % j);
}
template <typename T>
inline T getint() {
  T val = 0;
  char c;
  bool neg = false;
  while ((c = getchar()) && !(c >= '0' && c <= '9')) {
    neg |= c == '-';
  }
  do {
    val = (val * 10) + c - '0';
  } while ((c = getchar()) && (c >= '0' && c <= '9'));
  return val * (neg ? -1 : 1);
}
const long long INF = 1e18 + 100;
const int mod = 1000000007;
const long double eps = 1e-10, pi = acosl(-1);
const long long maxN = 200010, maxT = 25000, A = 179, mid = 150;
mt19937 mt_rand(time(0));
long long bp(long long et, long long b) {
  b %= mod - 1;
  long long res = 1;
  for (int i = 30; i >= 0; --i) {
    res = (res * res) % mod;
    if ((b & (1 << i)) != 0) res = (res * et) % mod;
  }
  return res;
}
void panic() {
  cout << "-1\n";
  exit(0);
}
vector<vector<int>> g;
vector<int> cnt;
void dfs(int v, int d, int p = -1) {
  ++cnt[d];
  for (auto x : g[v]) {
    if (x == p) continue;
    dfs(x, d + 1, v);
  }
}
void solve() {
  int n, k;
  cin >> n >> k;
  g.assign(n, vector<int>());
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  if (k == 2) {
    cout << n * (n - 1) / 2 << "\n";
    return;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    vector<vector<int>> dp(n, vector<int>(k + 1));
    for (int i = 0; i < n; ++i) dp[i][0] = 1;
    for (auto x : g[i]) {
      cnt.assign(n, 0);
      dfs(x, 1, i);
      for (int d = 0; d < n; ++d) {
        if (cnt[d] == 0) continue;
        for (int j = k - 1; j >= 0; --j) {
          dp[d][j + 1] = (dp[d][j + 1] + (long long)cnt[d] * dp[d][j]) % mod;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      ans = (ans + dp[i][k]) % mod;
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

```