def loop(r)
  a, b, d = r.numerator, r.numerator, r.denominator
  arr = [e(b, d) / d]
  a, b = e(a, d), e(e(b, d) % d, d)
  while a != b
    arr << b / d << e(b % d, d) / d
    a, b = e(a, d), e(e(b, d) % d, d)
  end
  arr << b / d
  return arr[0...(arr.size + 1) / 2].join, arr[(arr.size + 1) / 2..-1].join
end
def e(a, d)
  return (a % d) * 10 ** ((Math::log10(d + 1) - Math::log10(a + 1)).to_i + 1)
end
def main(input = STDIN)
  $s = [0r]
  while (n, k, m, r = input.gets.split(" ").map(&:to_i)) != [0, 0, 0, 0]
    s, l = loop((1 + m * s(n - 1)) / n)
    puts (((1 + m * s(n - 1)) / n == 1r) ? "1." : "0.") + s.ljust(r, l)
  end
end
def s(n)
  $s[n] = s(n - 1) + (1r / n) unless $s[n]
  return $s[n]
end
main