EPS = 1e-8
def dfs(remain, n, a, denominator)
  return 1 if remain.abs < EPS
  return 0 if remain < EPS
  return 0 if n <= 0
  return 0 if remain - n.to_f / denominator.to_f > EPS
  result = 0
  (denominator..a).each do |i|
    break if a / i.to_f < EPS
    result += dfs(remain - 1.0 / i.to_f, n - 1, a / i.to_f, i)
  end
  result
end

until (p, q, a, n = gets.split.map(&:to_f)).all?(&:zero?)
  p dfs(p / q, n.to_i, a, 1)
end