import sys from collections import defaultdict def solve(): N, K, M = map(int, sys.stdin.readline().split()) count = defaultdict(int) L = 2 while True: # Check if the minimal product (A=1) is possible product = 1 overflow = False for i in range(L): term = 1 + i * K if product > N // term: overflow = True break product *= term if product > N: overflow = True break if overflow: break # No more L to consider # Binary search to find the maximum A for current L low = 1 high = N # Upper bound for A best_A = 0 while low <= high: mid = (low + high) // 2 current_product = 1 valid = True for i in range(L): term = mid + i * K if term < 1: # A must be >=1, so terms cannot be <=0 valid = False break if current_product > N // term: valid = False break current_product *= term if current_product > N: valid = False break if valid: best_A = mid low = mid + 1 else: high = mid - 1 if best_A == 0: L += 1 continue # Now compute the product for each A from 1 to best_A for A in range(1, best_A + 1): current_product = 1 for i in range(L): term = A + i * K if term < 1: current_product = N + 1 break if current_product > N // term: current_product = N + 1 break current_product *= term if current_product > N: break if current_product <= N: count[current_product] += 1 L += 1 # Calculate the answer ans = 0 for x in count: if 1 <= x <= N and count[x] == M: ans += 1 print(ans) solve()