N,K,M = map(int,input().split()) if N==1: print(1) else: C = {} x = N for i in range(2,N+1): if i*i>N:break if x%i==0: cnt = 0 while x%i==0: cnt += 1 x //= i C[i] = cnt if x>1: C[x] = 1 for p in C: C[p] *= K P = list(C.keys()) ans = set() val = 1 def dfs(i): global val p = P[i] for j in range(C[p]+1): val *= pow(p,j) if val <=M: ans.add(val) if i+1