#include using namespace std; #define il __int128 il get_log(long long x){ il cnt=1; il res=0; while(cnt>=1; } return res; } int ans1[1010],len; long long N,ax,ay; il solve(il k){ il res=ceil(powl(N,(long double)(1.0/k))); il l=1,r=res,t=res; // cout<>1 ; if(qpow(mid,p)*qpow(mid+1,k-p)>N){ r=mid-1; t=mid; }else{ l=mid+1; } } resl=(resl(il)(ax-ay)*k+(il)ay*solve(k) ? (il)(ax-ay)*k+(il)ay*solve(k) : ans); } while(ans){ ans1[++len]=ans%10; ans/=10; } for(int i=len;i>=1;i--){ printf("%d",ans1[i]); } return 0; }