#include #define int __int128 using namespace std; int read() { int ans=0,fh=1; char ch=getchar(); while(ch>'9'||ch<'0') { if(ch=='-') fh=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { ans=ans*10+ch-'0'; ch=getchar(); } return ans*fh; } const int INF=1e18; int n; int logg(int n) { int cnt=0; int tmp=1; while(tmp<=n) { tmp*=2; cnt++; } return cnt; } int xs(int x,int y) { if(x%y) return x/y+1; else return x/y; } int ksm(int x,int k) { if(k==0) return 1; int res=ksm(x,k/2); if(res>=n) return n; if(k%2) return res*res*x; return res*res; } int erfen(int x) { int l=1,r=n; while(l<=r) { int mid=(l+r)>>1; if(ksm(mid,x)>=n) r=mid-1; else l=mid+1; } int ans=l*x; for(int i=1;i<=x;i++) { if(ksm(l,x-i)*ksm(l-1,i)>=n) ans--; else break; } return ans-x; } void print(int n) { if(n>=10) print(n/10); putchar(n%10+'0'); return; } signed main() { // freopen("dice.in","r",stdin); // freopen("dice.out","w",stdout); int x,y; x=read();y=read();n=read(); int lg=logg(n); int ans=INF; for(int i=1;i<=lg;i++) { ans=min(ans,erfen(i)*y+i*x); } print(ans); return 0; }