#include #define rep(i,n) for(int i=0;i ; const ll INF = 1e10; const int MOD = 1000000007; long long modpow(long long a, long long b){ bitset<50> bit(b); string s = bit.to_string(); long long ret = 1; for (int i = 0;i< s.length(); ++i){ ret = (ret * ret) % MOD; if(s[i]-'0') ret = (ret * a) % MOD; } 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; }