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 JAVA):

Solution:
import java.util.*;

public class TaskF {
    private static final long MOD = 1_000_000_000 + 7;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int m = in.nextInt();

        initFactorials(Math.max(n, m));
        System.out.println(solve(n, m));

        in.close();
    }

    private static long solve(int n, int m) {
        long sum = 0;
        for (int k = 1; k <= n - 1; k++) {
            long splits = splits(m, k);
            long perms = perms(n, k);
            long rest = rest(n, m, k);
            sum += (((splits * perms) % MOD) * rest) % MOD;
            sum = sum % MOD;
        }
        return sum;
    }

    private static long splits(int sum, int count) {
        return modCombinations(sum - 1, count - 1);
    }

    private static long perms(int n, int k) {
        return modKPermutations(n - 2, k - 1);
    }

    private static long rest(int n, int m, int k) {
        return (modNumberOfTrees(n, k + 1) * modPower(m, n - 1 - k)) % MOD;
    }

    private static long modNumberOfTrees(int n, int y) {
        if (n < y) {
            return 0;
        } else if (n == y) {
            return 1;
        } else {
            return (y * modPower(n, n - y - 1)) % MOD;
        }
    }

    private static long[] factorial;
    private static long[] inverse;
    private static long[] inverseFactorial;

    private static void initFactorials(int upTo) {
        factorial = new long[upTo + 1];
        inverse = new long[upTo + 1];
        inverseFactorial = new long[upTo + 1];
        factorial[0] = 1;
        factorial[1] = 1;
        for (int i = 2; i <= upTo; i++) {
            factorial[i] = (factorial[i - 1] * i) % MOD;
        }
        inverse[0] = 1;
        inverse[1] = 1;
        for (int i = 2; i <= upTo; i++) {
            inverse[i] = (MOD - (MOD / i) * inverse[(int)MOD % i] % MOD) % MOD;
        }
        inverseFactorial[0] = inverse[0];
        for (int i = 1; i <= upTo; i++) {
            inverseFactorial[i] = (inverseFactorial[i - 1] * inverse[i]) % MOD;
        }
    }

    private static long modKPermutations(int n, int k) {
        if (n < k) return 0;
        return (factorial[n] * inverseFactorial[n - k]) % MOD;
    }

    private static long modCombinations(int n, int k) {
        if (n < k) return 0;
        return (((factorial[n] * inverseFactorial[k]) % MOD) * inverseFactorial[n - k]) % MOD;
    }

    private static long modPower(int n, int p) {
        if (p == 0) {
            return 1;
        } else if (p % 2 == 1) {
            return (n * modPower(n, p - 1)) % MOD;
        } else {
            long halfPower = modPower(n, p / 2);
            return (halfPower * halfPower) % MOD;
        }
    }

    private static long modRestoreFactorMapToNumber(Map<Integer, Integer> factorMap) {
        long result = 1;
        for (int prime : factorMap.keySet()) {
            result = (result * modPower(prime, factorMap.get(prime))) % MOD;
        }
        return result;
    }

    private static class MapTools {
        public Map<Integer, Integer> subtractCounts(
                Map<Integer, Integer> a, Map<Integer, Integer> b) {

            Map<Integer, Integer> result = new HashMap<>(a);

            for (int bKey : b.keySet()) {
                if (!result.containsKey(bKey)) {
                    throw new RuntimeException("No such key: " + bKey);
                }
                result.put(bKey, result.get(bKey) - b.get(bKey));
            }

            return result;
        }
    }

    private static class Primes {
        private final List<Integer> primes = new ArrayList<>();
        private int primesLimit;

        private final Map<Integer, Map<Integer, Integer>> factorialFactorizationCache = new HashMap<>();
        public Map<Integer, Integer> factorFactorial(int n) {
            return factorialFactorizationCache.computeIfAbsent(n, $ -> {
                calculatePrimesUpTo(n);
                Map<Integer, Integer> result = new HashMap<>();
                for (int p : primes) {
                    if (p > n) break;
                    int count = 0;
                    int pPower = p;
                    while (pPower <= n) {
                        count += n / pPower;
                        pPower *= p;
                    }
                    result.put(p, count);
                }
                return result;
            });
        }

        private void calculatePrimesUpTo(int newLimit) {
            if (newLimit <= primesLimit) return;

            int start = primesLimit + 1;
            if (start <= 2) {
                start = 2;
            }
            for (int i = start; i <= newLimit; i++) {
                if (isPrime(i)) {
                    primes.add(i);
                }
            }

            primesLimit = newLimit;
        }

        private boolean isPrime(int n) {
            for (int p : primes) {
                if (p * p > n) break;
                if (n % p == 0) return false;
            }
            return true;
        }
    }
}