#include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void read(_T &x) {
  x = 0;
  char s = getchar();
  long long f = 1;
  while (s < '0' || s > '9') {
    f = 1;
    if (s == '-') f = -1;
    s = getchar();
  }
  while ('0' <= s && s <= '9') {
    x = (x << 3) + (x << 1) + s - '0';
    s = getchar();
  }
  x *= f;
}
const long long np = 105;
const long long mod = 1e9 + 7;
long long fac[np], inv[np];
inline long long power(long long a, long long b) {
  long long res(1);
  while (b) {
    if (b & 1) res = res * a, res %= mod;
    a = a * a;
    a %= mod;
    b >>= 1;
  }
  return res;
}
inline long long c(long long n_, long long m_) {
  return ((fac[n_] * inv[n_ - m_] % mod) * inv[m_]) % mod;
}
long long head[np], nxt[np * 2], ver[np * 2], tit;
inline void add(long long x, long long y) {
  ver[++tit] = y;
  nxt[tit] = head[x];
  head[x] = tit;
}
long long dep[np], maxn;
long long sub[np][np];
long long dp[np][np];
long long n, k;
inline void dfs(long long x, long long ff, long long id) {
  dep[x] = dep[ff] + 1;
  maxn = max(dep[x], maxn);
  sub[id][dep[x]]++;
  for (long long i = head[x], v; i; i = nxt[i]) {
    v = ver[i];
    if (v == ff) continue;
    dfs(v, x, id);
  }
}
signed main() {
  fac[0] = 1;
  for (long long i = 1; i <= 100; i++) fac[i] = fac[i - 1] * i, fac[i] %= mod;
  for (long long i = 0; i <= 100; i++) inv[i] = power(fac[i], mod - 2);
  long long T;
  read(T);
  while (T--) {
    read(n);
    read(k);
    for (long long i = 1, a, b; i < n; i++) {
      read(a);
      read(b);
      add(a, b);
      add(b, a);
    }
    if (k == 2) {
      long long ans = c(n, 2);
      printf("%lld\n", ans);
      memset(head, 0, sizeof(head));
      tit = 0;
      continue;
    }
    long long Ans = 0;
    for (long long i = 1; i <= n; i++) {
      dep[i] = 1;
      long long ql = 0;
      maxn = 0;
      for (long long q = head[i]; q; q = nxt[q]) dfs(ver[q], i, ++ql);
      if (ql >= k) {
        for (long long h = 1; h <= maxn; h++) {
          dp[0][0] = 1;
          for (long long a = 1; a <= ql; a++)
            for (long long b = 0; b <= k; b++)
              dp[a][b] =
                  (dp[a - 1][b] + (dp[a - 1][b - 1] * sub[a][h]) % mod) % mod;
          Ans += dp[ql][k];
          Ans %= mod;
        }
      }
      memset(sub, 0, sizeof(sub));
      memset(dp, 0, sizeof(dp));
      memset(dep, 0, sizeof(dep));
    }
    printf("%lld\n", Ans);
    for (long long i = 1; i <= n; i++) head[i] = 0;
    tit = 0;
  }
}

### Prompt

Please create a solution in cpp 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>
using namespace std;
template <typename _T>
inline void read(_T &x) {
  x = 0;
  char s = getchar();
  long long f = 1;
  while (s < '0' || s > '9') {
    f = 1;
    if (s == '-') f = -1;
    s = getchar();
  }
  while ('0' <= s && s <= '9') {
    x = (x << 3) + (x << 1) + s - '0';
    s = getchar();
  }
  x *= f;
}
const long long np = 105;
const long long mod = 1e9 + 7;
long long fac[np], inv[np];
inline long long power(long long a, long long b) {
  long long res(1);
  while (b) {
    if (b & 1) res = res * a, res %= mod;
    a = a * a;
    a %= mod;
    b >>= 1;
  }
  return res;
}
inline long long c(long long n_, long long m_) {
  return ((fac[n_] * inv[n_ - m_] % mod) * inv[m_]) % mod;
}
long long head[np], nxt[np * 2], ver[np * 2], tit;
inline void add(long long x, long long y) {
  ver[++tit] = y;
  nxt[tit] = head[x];
  head[x] = tit;
}
long long dep[np], maxn;
long long sub[np][np];
long long dp[np][np];
long long n, k;
inline void dfs(long long x, long long ff, long long id) {
  dep[x] = dep[ff] + 1;
  maxn = max(dep[x], maxn);
  sub[id][dep[x]]++;
  for (long long i = head[x], v; i; i = nxt[i]) {
    v = ver[i];
    if (v == ff) continue;
    dfs(v, x, id);
  }
}
signed main() {
  fac[0] = 1;
  for (long long i = 1; i <= 100; i++) fac[i] = fac[i - 1] * i, fac[i] %= mod;
  for (long long i = 0; i <= 100; i++) inv[i] = power(fac[i], mod - 2);
  long long T;
  read(T);
  while (T--) {
    read(n);
    read(k);
    for (long long i = 1, a, b; i < n; i++) {
      read(a);
      read(b);
      add(a, b);
      add(b, a);
    }
    if (k == 2) {
      long long ans = c(n, 2);
      printf("%lld\n", ans);
      memset(head, 0, sizeof(head));
      tit = 0;
      continue;
    }
    long long Ans = 0;
    for (long long i = 1; i <= n; i++) {
      dep[i] = 1;
      long long ql = 0;
      maxn = 0;
      for (long long q = head[i]; q; q = nxt[q]) dfs(ver[q], i, ++ql);
      if (ql >= k) {
        for (long long h = 1; h <= maxn; h++) {
          dp[0][0] = 1;
          for (long long a = 1; a <= ql; a++)
            for (long long b = 0; b <= k; b++)
              dp[a][b] =
                  (dp[a - 1][b] + (dp[a - 1][b - 1] * sub[a][h]) % mod) % mod;
          Ans += dp[ql][k];
          Ans %= mod;
        }
      }
      memset(sub, 0, sizeof(sub));
      memset(dp, 0, sizeof(dp));
      memset(dep, 0, sizeof(dep));
    }
    printf("%lld\n", Ans);
    for (long long i = 1; i <= n; i++) head[i] = 0;
    tit = 0;
  }
}

```