#include using namespace std; using ll = long long; using PII = std::pair; using PLL = std::pair; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) ll pow_mod(ll p, ll q, int mod) { ll ret, r; ret = 1; r = p; while (q > 0) { if (q % 2) { ret *= r; ret %= mod; } r = (r * r) % mod; q /= 2; } return ret % mod; } int main() { #ifdef DEBUG cout << "DEBUG MODE" << endl; ifstream in("input.txt"); //for debug cin.rdbuf(in.rdbuf()); //for debug #endif const int mod = 1e9 + 7; ll b, c, d, ans; cin >> b >> c >> d; b %= mod, c %= mod; if (c == 1) { ans = (b * d) % mod; } else { ans = (b * c) % mod; ans *= pow_mod(c, d, mod) - 1; ans %= mod; ans *= pow_mod(c-1, mod-2, mod); ans %= mod; } cout << ans << endl; return 0; }