def loop(rat, r)
  a, b, d = rat.numerator, rat.numerator * 10, rat.denominator
  arr = Array.new
  phi = phi(d)
  [r, phi].min.times do
    arr << b / d
    b = (b % d) * 10
  end
  while a != b and arr.size < r
    arr << b / d 
    a, b = (a % d) * 10, (b % d) * 10
  end
  if arr.size == r
    return ((r == 1) ? "1." : "0.") + arr.join
  else
    return ((r == 1) ? "1." : "0.") + arr[0...-phi].join.ljust(r, arr[-phi..-1].join)
  end
end
def main(input = STDIN)
  $s = [Rational(0,1)]
  3.times do |t|
    s(5000 * (t + 1))
  end
  while (n, k, m, r = input.gets.split(" ").map(&:to_i)) != [0, 0, 0, 0] # !> assigned but unused variable - k
    puts loop((1 + m * s(n - 1)) / n, r)
  end
end
def phi(n)
  result = n
  result /= 2 if n % 2 == 0
  n /= 2 while n % 2 == 0
  prime = 3
  while n != 1
    if n % prime == 0
      result = result * (prime - 1) / prime
      n /= prime while n % prime == 0
    end
    prime += 2
  end
  return result
end
 
def s(n)
  $s[n] = Rational(1, n) + s(n - 1) unless $s[n]
  return $s[n]
end
main