Helga Hufflepuff’s Cup

Harry, Ron and Hermione have figured out that Helga Hufflepuff’s cup is a horcrux. Through her encounter with Bellatrix Lestrange, Hermione came to know that the cup is present in Bellatrix’s family vault in Gringott’s Wizarding Bank.

The Wizarding bank is in the form of a tree with total n vaults where each vault has some type, denoted by a number between 1 to m. A tree is an undirected connected graph with no cycles.

The vaults with the highest security are of type k, and all vaults of type k have the highest security.

There can be at most x vaults of highest security.

Also, if a vault is of the highest security, its adjacent vaults are guaranteed to not be of the highest security and their type is guaranteed to be less than k.

Harry wants to consider every possibility so that he can easily find the best path to reach Bellatrix’s vault. So, you have to tell him, given the tree structure of Gringotts, the number of possible ways of giving each vault a type such that the above conditions hold.

Input

The first line of input contains two space separated integers, n and m — the number of vaults and the number of different vault types possible. (1 ≤ n ≤ 105, 1 ≤ m ≤ 109).

Each of the next n - 1 lines contain two space separated integers u i and v i (1 ≤ u i, v i ≤ n) representing the i-th edge, which shows there is a path between the two vaults u i and v i. It is guaranteed that the given graph is a tree.

The last line of input contains two integers k and x (1 ≤ k ≤ m, 1 ≤ x ≤ 10), the type of the highest security vault and the maximum possible number of vaults of highest security.

Output

Output a single integer, the number of ways of giving each vault a type following the conditions modulo 109 + 7.

Examples

input

4 2
1 2
2 3
1 4
1 2

output

1

input

3 3
1 2
1 3
2 1

output

13

input

3 1
1 2
1 3
1 1

output

0

Note

In test case 1, we cannot have any vault of the highest security as its type is 1 implying that its adjacent vaults would have to have a vault type less than 1, which is not allowed. Thus, there is only one possible combination, in which all the vaults have type 2.

Solution:

#include <bits/stdc++.h>

using namespace std;

const int md = (int) 1e9 + 7;

inline void add(int &a, int b) {
a += b;
if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
a -= b;
if (a < 0) a += md;
}

inline int mul(int a, int b) {
#if !defined(_WIN32) || defined(_WIN64)
  return (long long) a * b % md;
#endif
  unsigned long long x = (long long) a * b;
  unsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, m;
asm(
"divl %4; \n\t"
: "=a" (d), "=d" (m)
: "d" (xh), "a" (xl), "r" (md)
);
return m;
}

inline int power(int a, int b) {
int res = 1;
while (b > 0) {
if (b & 1) {
res = mul(res, a);
}
a = mul(a, a);
b >>= 1;
}
return res;
}

inline int inv(int a) {
a %= md;
if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

const int N = 1234567;

vector<int> g[N];
int f[N][12][3];
int aux[12][3];
int m, k, x;

void solve(int v, int pr) {
for (int cnt = 0; cnt <= x; cnt++) {
    for (int type = 0; type <= 2; type++) {
      f[v][cnt][type] = 0;
    }
  }
  f[v][0][0] = k - 1;
  f[v][1][1] = 1;
  f[v][0][2] = m - k;
  for (int u : g[v]) {
    if (u == pr) {
      continue;
    }
    solve(u, v);
    for (int cnt = 0; cnt <= x; cnt++) {
      for (int type = 0; type <= 2; type++) {
        aux[cnt][type] = 0;
      }
    }
    for (int cnt = 0; cnt <= x; cnt++) {
      for (int type = 0; type <= 2; type++) {
        int ft = f[v][cnt][type];
        if (ft == 0) {
          continue;
        }
        for (int new_cnt = 0; cnt + new_cnt <= x; new_cnt++) {
          for (int new_type = 0; new_type <= 2; new_type++) {
            if ((type == 1 || new_type == 1) && type + new_type != 1) {
              continue;
            }
            int gt = f[u][new_cnt][new_type];
            if (gt == 0) {
              continue;
            }
            add(aux[cnt + new_cnt][type], mul(ft, gt));
          }
        }
      }
    }
    for (int cnt = 0; cnt <= x; cnt++) {
      for (int type = 0; type <= 2; type++) {
        f[v][cnt][type] = aux[cnt][type];
      }
    }
  }
}

int main() {
  int n;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--; y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  scanf("%d %d", &k, &x);
  solve(0, -1);
  int ans = 0;
  for (int cnt = 0; cnt <= x; cnt++) {
    for (int type = 0; type <= 2; type++) {
      add(ans, f[0][cnt][type]);
    }
  }
  printf("%d\n", ans);
  return 0;
}