import sys import math def count_x(B, K, N): if B == 0: return N low = 1 high = min(N // 1, 2 * 10**18) best = 0 while low <= high: mid = (low + high) // 2 product = 1 a = mid for i in range(B + 1): if product > N: break product *= (a + i * K) if product > N: break if product <= N: best = mid low = mid + 1 else: high = mid - 1 if best == 0: return 0 else: return best def main(): N, K, M = map(int, sys.stdin.readline().split()) B_max = 0 a = 1 product = 1 while True: product *= (a + B_max * K) if product > N or B_max > 100: break B_max += 1 B_max -= 1 count_dict = {} for B in range(0, B_max + 1): if B == 0: if M >= 1: possible_x = N if M == 1: if possible_x not in count_dict: count_dict[possible_x] = 0 count_dict[possible_x] += 1 continue max_a = count_x(B, K, N) if max_a == 0: continue for a in range(1, max_a + 1): product = 1 for i in range(B + 1): term = a + i * K product *= term if product > N: break if product > N: break if product in count_dict: count_dict[product] += 1 else: count_dict[product] = 1 result = 0 for x in count_dict: if count_dict[x] == M: result += 1 print(result) if __name__ == "__main__": main()