#include #include #include #include #include #include #include #include #include #include #include #include typedef unsigned long long ULLONG; typedef long long LLONG; static const LLONG MOD_NUM = 1000000007;//998244353; template static void getval(_T& a) { std::cin >> a; } template static void getval(_T& a, _T& b) { std::cin >> a >> b; } template static void getval(_T& a, _T& b, _T& c) { std::cin >> a >> b >> c; } static void exec(); int main() { exec(); fflush(stdout); return 0; } static void exec() { LLONG V, T, P; getval(V, T, P); if (P) { V = V * (P + 1); } LLONG rd = V / T; LLONG rdtmp = (rd + V % T) / T; rd += rdtmp; while (rdtmp) { rdtmp = (rdtmp + rdtmp % T) / T; rd += rdtmp; } LLONG ans = V + rd + 1; printf("%lld\n", ans); }