ll a[6d5],b,x;{ll@k,@q;for(;x<1d18;a[++b]=x+=1+x/~-k);rep(q){ll@n;wt(a[bsearch_max[ll,m,0,b](a[m]