#include #define rep(i,n) for(int i=0;i ; const ll INF = 1e10; const int MOD = 1000000007; long long modpow(long long x, long long n) { long long ret = 1; while (n > 0) { if (n & 1) ret = (ret * x) % MOD; x = (x * x) % MOD; n >>= 1; } return ret; } /*繰り返し二乗法でxのmod逆元を取る*/ long long inverse(long long x){ return modpow(x,MOD-2); } int main(){ ll b,c,d; cin >> b >> c >> d; b %= MOD; c %= MOD; if(c==1){ d %= MOD; cout << (b*d)%MOD << endl; }else{ ll ans = (((modpow(c,d) - 1 + MOD)%MOD) * ((c * b)%MOD))%MOD; ans = (ans * inverse((c-1+MOD)%MOD))%MOD; cout << ans << endl; } return 0; }