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.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        TaskC solver = new TaskC(in, out);
        solver.solve();
        out.close();
    }

    static class TaskC {

        static int n;
        static int m;

        static int[] inv;
        static int[] fact;
        static int[] invfact;

        static int[] powN;
        static int[] powM;

        InputReader in;
        OutputWriter out;

        TaskC(InputReader in, OutputWriter out) {
            this.in = in;
            this.out = out;
        }

        private void solve() {
            n = in.readInt();
            m = in.readInt();
            precalc();
            int ans = 0;
            int choosePath = 1;
            for(int k = 1; k < n; ++k) {
                if (k > m) break;
                int cur = MathUtil.mul(choosePath, cayley(n, k + 1));
                cur = MathUtil.mul(cur, binom(m - 1, k - 1));
                cur = MathUtil.mul(cur, powM[n - k - 1]);
                choosePath = MathUtil.mul(choosePath, n - k - 1);
                ans = MathUtil.sum(ans, cur);
            }
            out.print(ans);
        }

        private int cayley(int n, int k) {
            if (n - k - 1 < 0) {
                return MathUtil.mul(k, MathUtil.binPow(n, MathUtil.mod - 2));
            }
            return MathUtil.mul(k, powN[n - k - 1]);
        }

        private int binom(int n, int k) {
            return MathUtil.mul(fact[n], MathUtil.mul(invfact[k], invfact[n - k]));
        }

        private void precalc() {
            powN = new int[n + 1];
            powM = new int[n + 1];
            powN[0] = 1;
            powM[0] = 1;
            for(int i = 1; i <= n; ++i) {
                powN[i] = MathUtil.mul(powN[i - 1], n);
                powM[i] = MathUtil.mul(powM[i - 1], m);
            }

            inv = new int[m + 1];
            fact = new int[m + 1];
            invfact = new int[m + 1];
            inv[0] = inv[1] = 1;
            fact[0] = fact[1] = 1;
            invfact[0] = invfact[1] = 1;
            for(int i = 2; i <= m; ++i) {
                inv[i] = MathUtil.mul(inv[MathUtil.mod % i], MathUtil.mod - MathUtil.mod / i);
                fact[i] = MathUtil.mul(fact[i - 1], i);
                invfact[i] = MathUtil.mul(invfact[i - 1], inv[i]);
            }
        }
    }
    static class MathUtil {
        private static final int mod = 1_000_000_007;

        static int binPow(int a, int n) {
            int result = 1;
            while (n > 0) {
                if (n % 2 == 1) {
                    result = mul(result, a);
                }
                n /= 2;
                a = mul(a, a);
            }
            return result;
        }

        static int mul(int a, int b) {
            return (int)((long)a * b % mod);
        }

        static int sum(int a, int b) {
            int result = a + b;
            if (result >= mod) result -= mod;
            return result;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, readInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, readInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }

    }
}