func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const int N = 1e6 + 4;   long long fac[N], infac[N];   long long me(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % mod;       b >>= 1;       a = (a * a) % mod;     }     return res;   }   long long mi(long long n) { return me(n, mod - 2); }   void factorial() {     fac[0] = 1;     for (long long i = 1; i < N; i++) fac[i] = (i * fac[i - 1]) % mod;     infac[N - 1] = mi(fac[N - 1]);     for (long long i = N - 1; i > 0; i--) infac[i - 1] = (i * infac[i]) % mod;   }   long long ncr(long long n, long long r) {     if (n < r) return 0;     long long res = fac[n];     res = (res * infac[r]) % mod;     res = (res * infac[n - r]) % mod;     return res;   }   int main() {     factorial();     long long n, m;     scanf( %lld , &n);     scanf( %lld , &m);     long long ans = me(m, n);     for (long long s = 1; s <= n; s++) {       long long val = me(m, s), temp = me(m - 1, n - s);       val = (val * temp) % mod;       val = (val * ncr(n, s - 1));       ans = (ans + val) % mod;     }     printf( %lld , ans);     return 0;   }   