### constant

MAX_N = 100000
DELTA = 1.0e-16

### main

evs = [0.0, 1.0]

for i in (2..MAX_N)
  pi = 1.0
  w = 0.5
  evs[i] = 0.0

  for k in (1...i)
    break if pi < DELTA

    evs[i] += pi * (1 - w) * (k + evs[[0, i - k - 1].max])
    pi *= w
    w /= 2
  end

  evs[i] += i * pi
end

loop do
  n = gets.to_i
  break if n == 0

  puts "%.8f" % evs[n]
end