$arr = [1, 1, 1]
def calc(n)
  $arr = ($arr[2]...n).reduce($arr[0,2]){ |b, i| [b[0] * i + b[1], b[1] * i] }.push(n)
  $arr[0,2]
end
while true
  n, k, m, r = gets.split.map(&:to_i)
  break if n == 0
  if m == 0 then x, y = 1, n
  else
    x, y = calc(n)
    y *= n
    g = x.gcd y
    x /= g; y /= g
  end 
  x, mod = x.divmod y
  print x, '.'
  x = mod * 10
  r.times.reduce(x){ |t, _| t, mod = t.divmod y; print t; mod * 10 }
  puts
end