func_code_string: #include <bits/stdc++.h>   const long long M = 1000005;   const long long mod = 1e9 + 7;   using namespace std;   long long n, m, a, b, fac[M], Ans;   inline long long Fpw(long long Base, long long k) {     long long temp = 1;     while (k) {       if (k & 1) temp = (1LL * temp * Base) % mod;       Base = (1LL * Base * Base) % mod;       k >>= 1;     }     return temp;   }   inline long long Inv(long long a) { return Fpw(a, mod - 2); }   inline long long C(long long n, long long m) {     if (n < 0 || m < 0 || n < m) return 0;     return fac[n] * Inv(fac[m]) % mod * Inv(fac[n - m]) % mod;   }   int main() {     scanf( %lld%lld , &n, &m);     fac[0] = 1;     for (long long i = 1; i <= 1000000; i++)       fac[i] = (1LL * fac[i - 1] * i) % mod;     for (long long i = 2; i <= n; i++) {       long long temp = C(n - 2, i - 2) * fac[i - 2] % mod;       temp = temp * C(m - 1, i - 2) % mod;       if (n - i - 1 >= 0) temp = temp * i % mod * Fpw(n, n - i - 1) % mod;       temp = temp * Fpw(m, n - i) % mod;       Ans = (Ans + temp) % mod;     }     printf( %lld n , Ans);     return 0;   }   