#include #define int __int128 using namespace std; int n,a,b,ans=1e15; int qread(){ int w=1,ret; char c; while((c=getchar())>'9'||c<'0')w=(c=='-')?-1:1; ret=c-'0'; while((c=getchar())>='0'&&c<='9')ret=ret*10+c-'0'; return w*ret; } int fpow(int n,int k){ int ret=1; for(;k;k>>=1){ if(k&1)ret=ret*n; n=n*n; } return ret; } bool check(int x,int y){ int z=1; while(y){ if(z*x>n)return true; z*=x; y--; } return false; } signed main(){ a=qread(); b=qread(); n=qread(); for(int i=1;i<=63;i++){ int l=1,r=n+1,z=1,res=0; while(l>1; if(check(mid,i))r=mid; else l=mid+1; } z=fpow(r,i); res=i*(a+b*(r-1)); for(int j=1;jn){ z=z/r*(r-1); res-=b; } else break; } ans=min(res,ans); } printf("%lld\n",(long long)ans); return 0; }