from collections import Counter n, k, m = map(int, input().split()) c = Counter() for s in range(1, 10 ** 6 + 1): now = 1 for i in range(100): now *= s + i * k if now > n: break if i >= 2: c[now] += 1 def g(x): # a(a+k) = x if 1 + k > x: return False l = 1 r = 10 ** 9 while r - l > 1: c = (r + l) // 2 if c * (c + k) <= x: l = c else: r = c return l * (l + k) == x ans = 0 for x, cnt in c.items(): if g(x): if m == 1: ans -= 1 elif cnt + 1 == m: ans += 1 elif cnt == m: ans += 1 if m == 1 and 1 + k <= n: l = 1 r = 10 ** 9 while r - l > 1: c = (r + l) // 2 if c * (c + k) <= n: l = c else: r = c ans += l print(ans)