n,k,m=map(int,input().split()) big2={} for b in range(3,20): i=1 while 1: x=1 for j in range(b):x*=i+j*k if x>n:break big2.setdefault(x,0);big2[x]+=1;i+=1 count_2=0 ng=10**9 while-~count_2>1 if(m+k)*m>n:ng=m else:count_2=m for i in big2:y=round(-k/2+((k/2)**2+i)**0.5);g=y*(y+k)==i;big2[i]+=g;count_2-=g print(sum(big2[i]==m for i in big2)+[0,count_2][m==1])