#include using namespace std; int main() { int A, B, N; cin >> A >> B >> N; long long ans = LLONG_MAX; for (int i = 1; i <= 30; ++i) { int ret = pow(N, 1. / i); for (int j = 0; j <= i; ++j) { long long imm = 0, num = 1; for (int k = 0; k < i; ++k) { if (k < j) { imm += 1LL * ret * B + A; num *= ret + 1; } else { imm += 1LL * (ret - 1) * B + A; num *= ret; } if (num >= N) break; } if (num >= N) ans = min(ans, imm); } } cout << ans << endl; }