#include #include #include #include #include using namespace std; #define YES(condition) if(condition){ cout << "YES" << endl; }else{ cout << "NO" << endl; } #define Yes(condition) if(condition){ cout << "Yes" << endl; }else{ cout << "No" << endl; } #define Poss(condition) if(condition){ cout << "Possible" << endl; }else{ cout << "Impossible" << endl; } #define mod long(1e9 + 7) long power(long base, long exponent){ if(exponent % 2){ return power(base, exponent - 1) * base % mod; }else if(exponent){ long root_ans = power(base, exponent / 2); return root_ans * root_ans % mod; }else{ return 1; }} int main(){ long B, C, D; cin >> B >> C >> D; B %= mod; C %= mod; D %= mod; if(C == 1){ cout << B * D % mod << endl; return 0; } cout << B * (power(C, D + 1) - C + mod) % mod * power((C + mod - 1) % mod, mod - 2) % mod << endl; }