#include #include #include #include #define int __int128 using namespace std; int qpow(int x,int y) { if(y == 0) return 1; int k = qpow(x,y / 2); if(y & 1) return k * k * x; else return k * k; } inline int read() { int x = 0, f = 1; char ch = getchar(); while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar(); } while(isdigit(ch)) { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); } return x * f; } void write(__int128 x) { if(x < 10) putchar('0' + x); else write(x / 10), putchar('0' + x % 10); } signed main() { long long n,x,y; __int128 ans = 9e18 + 1 + 1; // n = read(); x = read(); y = read(); cin >> x >> y >> n; if(n == 0) { cout << 0 << endl; return 0; } int up = log(n) / log(2) + 1; // cout << up << endl; for(int i = 1; i <= up; i++) { // assert(pow(n,1.0 / i)>=0); int u = floor(pow(n,1.0 / i)) + 1, cnt = 0; __int128 xm = 1; for(int j = 1; j <= i; j++) xm *= u; // assert(xm>=0); while(xm >= n) { xm /= u; xm *= (u - 1); cnt++; } xm /= (u - 1); xm *= u; // assert(xm>=0); cnt--; ans = min(ans, (__int128)i * x + (__int128)cnt * (u - 2) * y + (__int128)(i - cnt) * (u - 1) * y); // assert(ans>=0); } write(ans); cout << endl; return 0; }