#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;
ld const PI = 4 * atan((ld)1);
constexpr int mod = 1e9 + 7;
constexpr int MAX = 107;
template <int MOD = mod>
struct Mint {
  int val;
  Mint() : val(0) {}
  Mint(int64_t _val) : val((int)(_val % MOD)) {
    if (val < 0) val += MOD;
  }
  Mint &operator+=(const Mint &rhs) {
    val += rhs.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  Mint &operator-=(const Mint &rhs) {
    val -= rhs.val;
    if (val < 0) val += MOD;
    return *this;
  }
  Mint &operator*=(const Mint &rhs) {
    val = (int)(1ll * val * rhs.val % MOD);
    return *this;
  }
  friend Mint fpow(Mint x, int64_t y) {
    Mint res = 1;
    for (; y > 0; y >>= 1, x *= x) {
      if (y & 1) res *= x;
    }
    return res;
  }
  friend Mint inverse(Mint x) { return fpow(x, MOD - 2); }
  Mint &operator/=(const Mint &rhs) { return *this *= inverse(rhs); }
  friend Mint operator+(Mint a, const Mint &b) { return a += b; }
  friend Mint operator-(Mint a, const Mint &b) { return a -= b; }
  friend Mint operator-(Mint a) { return 0 - a; }
  friend Mint operator*(Mint a, const Mint &b) { return a *= b; }
  friend Mint operator/(Mint a, const Mint &b) { return a /= b; }
  friend ostream &operator<<(ostream &os, const Mint &a) { return os << a.val; }
  friend bool operator==(const Mint &a, const Mint &b) {
    return a.val == b.val;
  }
  friend bool operator!=(const Mint &a, const Mint &b) {
    return a.val != b.val;
  }
};
int n, k;
Mint<> fact[MAX], inv[MAX];
vector<int> adj[MAX];
Mint<> dp[MAX][MAX];
inline Mint<> choose(int a, int b) {
  if (a < b) return 0;
  return fact[a] * inv[b] * inv[a - b];
}
inline void getLevel(int node, int par, int h, vector<int> &level) {
  level[h]++;
  for (int to : adj[node]) {
    if (to != par) getLevel(to, node, h + 1, level);
  }
}
void solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    adj[i].clear();
  }
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  if (k == 2) {
    cout << choose(n, 2) << '\n';
    return;
  }
  const auto get = [&](vector<int> nums) -> Mint<> {
    int sz = (int)nums.size();
    for (int i = 0; i <= sz; ++i) dp[i][0] = 1;
    for (int i = 1; i <= sz; ++i)
      for (int j = 1; j <= min(i, k); ++j)
        dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1] * nums[i - 1];
    return dp[sz][k];
  };
  Mint<> res = 0;
  for (int node = 1; node <= n; ++node) {
    if ((int)adj[node].size() < k) continue;
    vector<vector<int>> vec;
    for (int to : adj[node]) {
      vector<int> level(n, 0);
      getLevel(to, node, 0, level);
      vec.push_back(level);
    }
    for (int i = 0; i < n; ++i) {
      vector<int> tmp;
      for (int j = 0; j < (int)vec.size(); ++j) {
        if (vec[j][i]) tmp.push_back(vec[j][i]);
      }
      if ((int)tmp.size() >= k) res += get(tmp);
    }
  }
  cout << res << '\n';
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  fact[0] = 1;
  for (int i = 1; i < MAX; ++i) fact[i] = i * fact[i - 1];
  inv[MAX - 1] = inverse(fact[MAX - 1]);
  for (int i = MAX - 2; i >= 0; --i) inv[i] = (i + 1) * inv[i + 1];
  int t;
  cin >> t;
  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>
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;
ld const PI = 4 * atan((ld)1);
constexpr int mod = 1e9 + 7;
constexpr int MAX = 107;
template <int MOD = mod>
struct Mint {
  int val;
  Mint() : val(0) {}
  Mint(int64_t _val) : val((int)(_val % MOD)) {
    if (val < 0) val += MOD;
  }
  Mint &operator+=(const Mint &rhs) {
    val += rhs.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  Mint &operator-=(const Mint &rhs) {
    val -= rhs.val;
    if (val < 0) val += MOD;
    return *this;
  }
  Mint &operator*=(const Mint &rhs) {
    val = (int)(1ll * val * rhs.val % MOD);
    return *this;
  }
  friend Mint fpow(Mint x, int64_t y) {
    Mint res = 1;
    for (; y > 0; y >>= 1, x *= x) {
      if (y & 1) res *= x;
    }
    return res;
  }
  friend Mint inverse(Mint x) { return fpow(x, MOD - 2); }
  Mint &operator/=(const Mint &rhs) { return *this *= inverse(rhs); }
  friend Mint operator+(Mint a, const Mint &b) { return a += b; }
  friend Mint operator-(Mint a, const Mint &b) { return a -= b; }
  friend Mint operator-(Mint a) { return 0 - a; }
  friend Mint operator*(Mint a, const Mint &b) { return a *= b; }
  friend Mint operator/(Mint a, const Mint &b) { return a /= b; }
  friend ostream &operator<<(ostream &os, const Mint &a) { return os << a.val; }
  friend bool operator==(const Mint &a, const Mint &b) {
    return a.val == b.val;
  }
  friend bool operator!=(const Mint &a, const Mint &b) {
    return a.val != b.val;
  }
};
int n, k;
Mint<> fact[MAX], inv[MAX];
vector<int> adj[MAX];
Mint<> dp[MAX][MAX];
inline Mint<> choose(int a, int b) {
  if (a < b) return 0;
  return fact[a] * inv[b] * inv[a - b];
}
inline void getLevel(int node, int par, int h, vector<int> &level) {
  level[h]++;
  for (int to : adj[node]) {
    if (to != par) getLevel(to, node, h + 1, level);
  }
}
void solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    adj[i].clear();
  }
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  if (k == 2) {
    cout << choose(n, 2) << '\n';
    return;
  }
  const auto get = [&](vector<int> nums) -> Mint<> {
    int sz = (int)nums.size();
    for (int i = 0; i <= sz; ++i) dp[i][0] = 1;
    for (int i = 1; i <= sz; ++i)
      for (int j = 1; j <= min(i, k); ++j)
        dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1] * nums[i - 1];
    return dp[sz][k];
  };
  Mint<> res = 0;
  for (int node = 1; node <= n; ++node) {
    if ((int)adj[node].size() < k) continue;
    vector<vector<int>> vec;
    for (int to : adj[node]) {
      vector<int> level(n, 0);
      getLevel(to, node, 0, level);
      vec.push_back(level);
    }
    for (int i = 0; i < n; ++i) {
      vector<int> tmp;
      for (int j = 0; j < (int)vec.size(); ++j) {
        if (vec[j][i]) tmp.push_back(vec[j][i]);
      }
      if ((int)tmp.size() >= k) res += get(tmp);
    }
  }
  cout << res << '\n';
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  fact[0] = 1;
  for (int i = 1; i < MAX; ++i) fact[i] = i * fact[i - 1];
  inv[MAX - 1] = inverse(fact[MAX - 1]);
  for (int i = MAX - 2; i >= 0; --i) inv[i] = (i + 1) * inv[i + 1];
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}

```