#include using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // iad int a, b, n; cin >> a >> b >> n; if (n == 1) { cout << 0 << endl; return 0; } // temp answer int ans = a + (n - 1) * b; for (int use_1 = 2; (1 << (use_1 - 1)) <= n; use_1++) { priority_queue, greater> pq; int duck = 1; int use_2 = use_1; for (int i = 1; i <= use_1; i++) duck *= 2; for (int i = 1; i <= use_1; i++) pq.push(2); while (duck < n) { int cur = pq.top(); pq.pop(); duck *= cur + 1; duck /= cur; use_2 += 1; pq.push(cur + 1); } ans = min(ans, a * use_1 + b * use_2); } cout << ans << endl; return 0; }