#include <bits/stdc++.h>
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const long long INF64 = (long long)1e18;
const double INFD = 1e30;
const double EPS = 1e-9;
const double PI = std::acos(-1);
const int MOD = 1e9 + 7;
template <typename T>
inline T read() {
  T X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
const int MAXN = 105;
const int MAXV = (1 << 17) + 5;
int dr[4] = {0, 1, 0, -1};
int dc[4] = {-1, 0, 1, 0};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int A[MAXN];
int fact[MAXN];
std::vector<int> G[MAXN];
int dep[MAXN];
int cnt[MAXN][MAXN];
int dp[MAXN][MAXN];
int fastExp(int x, int p, int mod) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = (long long)ans * x % mod;
    x = (long long)x * x % mod;
    p >>= 1;
  }
  return ans;
}
int getInv(int x, int mod) { return fastExp(x, MOD - 2, MOD); }
int choose(int n, int k) {
  if (k > n || n < 0 || k < 0) return 0;
  return fact[n] * getInv(fact[k] * fact[n - k] % MOD, MOD) % MOD;
}
void dfs(int x, int p) {
  for (auto v : G[x]) {
    if (v == p) continue;
    dep[v] = dep[x] + 1;
    dfs(v, x);
  }
}
void dfscnt(int x, int p, int pp) {
  cnt[pp][dep[x]]++;
  for (auto v : G[x]) {
    if (v == p) continue;
    dfscnt(v, x, pp);
  }
}
void solve() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) G[i].clear();
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  if (k == 2) {
    printf("%d\n", ((long long)n * (n - 1) / 2) % MOD);
    return;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    dep[i] = 0;
    dfs(i, i);
    int sz = G[i].size();
    if (sz < k) continue;
    for (int a = 0; a <= n; a++) {
      for (int b = 0; b <= n; b++) {
        cnt[a][b] = 0;
      }
    }
    for (int j = 0; j < sz; j++) {
      auto v = G[i][j];
      dfscnt(v, i, v);
    }
    for (int s = 1; s <= n; s++) {
      dp[0][0] = 1;
      for (int j = 1; j <= sz; j++) {
        auto v = G[i][j - 1];
        for (int l = 0; l <= k; l++) {
          dp[j][l] = dp[j - 1][l];
          if (l > 0) {
            dp[j][l] = dp[j][l] + (long long)cnt[v][s] * dp[j - 1][l - 1] % MOD;
            dp[j][l] %= MOD;
          }
        }
      }
      ans += dp[sz][k];
      ans %= MOD;
    }
  }
  printf("%d\n", ans);
}
int main() {
  fact[0] = 1;
  for (int i = 1; i <= 100; i++) {
    fact[i] = (long long)fact[i - 1] * i % MOD;
  }
  int T = read<int>();
  while (T--) {
    solve();
  }
  return 0;
}

### Prompt

Your task is to create 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>
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const long long INF64 = (long long)1e18;
const double INFD = 1e30;
const double EPS = 1e-9;
const double PI = std::acos(-1);
const int MOD = 1e9 + 7;
template <typename T>
inline T read() {
  T X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
const int MAXN = 105;
const int MAXV = (1 << 17) + 5;
int dr[4] = {0, 1, 0, -1};
int dc[4] = {-1, 0, 1, 0};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int A[MAXN];
int fact[MAXN];
std::vector<int> G[MAXN];
int dep[MAXN];
int cnt[MAXN][MAXN];
int dp[MAXN][MAXN];
int fastExp(int x, int p, int mod) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = (long long)ans * x % mod;
    x = (long long)x * x % mod;
    p >>= 1;
  }
  return ans;
}
int getInv(int x, int mod) { return fastExp(x, MOD - 2, MOD); }
int choose(int n, int k) {
  if (k > n || n < 0 || k < 0) return 0;
  return fact[n] * getInv(fact[k] * fact[n - k] % MOD, MOD) % MOD;
}
void dfs(int x, int p) {
  for (auto v : G[x]) {
    if (v == p) continue;
    dep[v] = dep[x] + 1;
    dfs(v, x);
  }
}
void dfscnt(int x, int p, int pp) {
  cnt[pp][dep[x]]++;
  for (auto v : G[x]) {
    if (v == p) continue;
    dfscnt(v, x, pp);
  }
}
void solve() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) G[i].clear();
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  if (k == 2) {
    printf("%d\n", ((long long)n * (n - 1) / 2) % MOD);
    return;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    dep[i] = 0;
    dfs(i, i);
    int sz = G[i].size();
    if (sz < k) continue;
    for (int a = 0; a <= n; a++) {
      for (int b = 0; b <= n; b++) {
        cnt[a][b] = 0;
      }
    }
    for (int j = 0; j < sz; j++) {
      auto v = G[i][j];
      dfscnt(v, i, v);
    }
    for (int s = 1; s <= n; s++) {
      dp[0][0] = 1;
      for (int j = 1; j <= sz; j++) {
        auto v = G[i][j - 1];
        for (int l = 0; l <= k; l++) {
          dp[j][l] = dp[j - 1][l];
          if (l > 0) {
            dp[j][l] = dp[j][l] + (long long)cnt[v][s] * dp[j - 1][l - 1] % MOD;
            dp[j][l] %= MOD;
          }
        }
      }
      ans += dp[sz][k];
      ans %= MOD;
    }
  }
  printf("%d\n", ans);
}
int main() {
  fact[0] = 1;
  for (int i = 1; i <= 100; i++) {
    fact[i] = (long long)fact[i - 1] * i % MOD;
  }
  int T = read<int>();
  while (T--) {
    solve();
  }
  return 0;
}

```