Problem: Once, during a lesson, Sasha got bored and decided to talk with his friends. Suddenly, he saw Kefa. Since we can talk endlessly about Kefa, we won't even start doing that. The conversation turned to graphs. Kefa promised Sasha to tell him about one interesting fact from graph theory if Sasha helps Kefa to count the number of beautiful trees. 

In this task, a tree is a weighted connected graph, consisting of n vertices and n-1 edges, and weights of edges are integers from 1 to m. Kefa determines the beauty of a tree as follows: he finds in the tree his two favorite vertices — vertices with numbers a and b, and counts the distance between them. The distance between two vertices x and y is the sum of weights of edges on the simple path from x to y. If the distance between two vertices a and b is equal to m, then the tree is beautiful.

Sasha likes graph theory, and even more, Sasha likes interesting facts, that's why he agreed to help Kefa. Luckily, Sasha is familiar with you the best programmer in Byteland. Help Sasha to count the number of beautiful trees for Kefa. Two trees are considered to be distinct if there is an edge that occurs in one of them and doesn't occur in the other one. Edge's weight matters.

Kefa warned Sasha, that there can be too many beautiful trees, so it will be enough to count the number modulo 10^9 + 7.

Input

The first line contains four integers n, m, a, b (2 ≤ n ≤ 10^6, 1 ≤ m ≤ 10^6, 1 ≤ a, b ≤ n, a ≠ b) — the number of vertices in the tree, the maximum weight of an edge and two Kefa's favorite vertices.

Output

Print one integer — the number of beautiful trees modulo 10^9+7.

Examples

Input


3 2 1 3


Output


5


Input


3 1 1 2


Output


2


Input


5 15 1 5


Output


345444

Note

There are 5 beautiful trees in the first example:

<image>

In the second example the following trees are beautiful:

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
inline int mod_add(int a, int b, int m = MOD) {
  int sum = a + b;
  return sum >= m ? sum - m : sum;
}
inline int mod_sub(int a, int b, int m = MOD) {
  int diff = a - b;
  return diff < 0 ? diff + m : diff;
}
inline unsigned fast_mod(uint64_t x, unsigned m = MOD) {
  return x % m;
  unsigned x_high = x >> 32, x_low = (unsigned)x;
  unsigned quot, rem;
  assert(x_high < m);
  asm("divl %4\n" : "=a"(quot), "=d"(rem) : "d"(x_high), "a"(x_low), "r"(m));
  return rem;
}
inline int mod_mul(int a, int b, int m = MOD) {
  return fast_mod((uint64_t)a * b, m);
}
inline int mod_pow(int a, long long p, int m = MOD) {
  assert(p >= 0);
  int result = 1;
  while (p > 0) {
    if (p & 1) result = mod_mul(result, a, m);
    a = mod_mul(a, a, m);
    p >>= 1;
  }
  return result;
}
inline int mod_inv(int a, int m = MOD) {
  int g = m, r = a, x = 0, y = 1;
  while (r != 0) {
    int q = g / r;
    g %= r;
    swap(g, r);
    x -= q * y;
    swap(x, y);
  }
  assert(g == 1);
  assert(y == m || y == -m);
  return x < 0 ? x + m : x;
}
vector<int> factorial, inv_factorial;
vector<int> inv;
void prepare_factorials(int max) {
  inv.assign(max + 1, 1);
  for (int p = 2; p * p <= MOD; p++) assert(MOD % p != 0);
  for (int i = 2; i <= max; i++) inv[i] = mod_mul(inv[MOD % i], MOD - MOD / i);
  factorial.resize(max + 1);
  inv_factorial.resize(max + 1);
  factorial[0] = inv_factorial[0] = 1;
  for (int i = 1; i <= max; i++) {
    factorial[i] = mod_mul(i, factorial[i - 1]);
    inv_factorial[i] = mod_mul(inv[i], inv_factorial[i - 1]);
  }
}
long long choose(int n, int r) {
  assert(0 <= r && r <= n);
  return mod_mul(factorial[n], mod_mul(inv_factorial[r], inv_factorial[n - r]));
}
int main() {
  int N, M;
  cin >> N >> M;
  prepare_factorials(max(N, M) + 5);
  vector<int> n_powers(N, 1), m_powers(N, 1);
  for (int i = 0; i + 1 < N; i++) {
    n_powers[i + 1] = mod_mul(n_powers[i], N);
    m_powers[i + 1] = mod_mul(m_powers[i], M);
  }
  int total = 0;
  for (int k = 2; k <= min(N, M + 1); k++) {
    int ways = mod_mul(factorial[N - 2], inv_factorial[N - k]);
    ways = mod_mul(ways, k == N ? 1 : mod_mul(k, n_powers[N - k - 1]));
    ways = mod_mul(ways, m_powers[N - k]);
    ways = mod_mul(ways, choose(M - 1, k - 2));
    total = mod_add(total, ways);
  }
  cout << total << '\n';
}