while true
  n, k, m, r = gets.split.map(&:to_i)
  break if n == 0
  x, y = 1, n
  if m == 1
    mx, my = (1...n).reduce([1, 1]){ |b, i| [b[0] * i + b[1], b[1] * i] }
    x *= mx; y *= my
  end 
  g = x.gcd y
  x / g; y / g
  x, mod = x.divmod y
  print x.to_s + "."
  x = mod * 10
  r.times.reduce(x){ |t, _| t, mod = t.divmod y; print t; mod * 10 }
  puts
end