#include #define int long long #define f first #define s second #define pb push_back #define endl '\n' using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") void solve() { int a,b,n; cin >> a >> b >> n; if (n == 1) { cout << 0 << endl; return; } int ans = LLONG_MAX; for (int use_a = 1; (1 << (use_a - 1)) <= n; use_a++) { priority_queue, greater> p; int pr = 1; int use_b = use_a; for (int i = 1; i <= use_a; i++) pr *= 2; for (int i = 1; i <= use_a; i++) p.push(2); while (pr < n) { int cur = p.top(); p.pop(); pr *= cur + 1; pr /= cur; use_b += 1; p.push(cur + 1); } // cout << use_a << " " << use_b << " " << a * use_a + b * use_b << endl; ans = min(ans, a * use_a + b * use_b); } cout << ans << endl; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int tttt = 1; // cin >> tttt; while (tttt--) solve(); }