#include using namespace std; using int64 = long long; using uint64 = unsigned long long; const int64 MOD = 1e9 + 7; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int64 B, C, D; cin >> B >> C >> D; B %= MOD; C %= MOD; int64 ans = 0, powC = C, cum = 1, sum = C; // c + c^2 + ... + c^{2^m} while (D > 0) { if (D & 1) { (ans += cum * sum) %= MOD; (cum *= powC) %= MOD; } sum = (sum + powC * sum) % MOD; (powC *= powC) %= MOD; D >>= 1; } (ans *= B) %= MOD; cout << ans << endl; return 0; }