n,k,m=map(int,input().split()) l=0 r=k-1 pos=0 while(l<r): mid=(l+r)//2 d=n//k+mid(+1)*max(min(mid,n%%k)0)