
def possibility_list(n)
  return [[true]] if n == 1

  result = [[true]]
  (n - 1).times {|n| result = result.map{|list| list.last == true ? [list.clone << true, list.clone << false] : [list.clone << true]}.flatten(1) }
  result
end

def except_value(p_list)
  p_list.inject(0) do |sum, list|
    sum + list.count(true) * probability(list)
  end
end

def probability(list)
  p = 1.0
  list.inject(1) do |result, value|
    if value
      next_result = result * p
      p /= 2
      next_result
    else
      next_result = result * (1.0 - p)
      p = 1.0
      next_result
    end
  end
end

while n = gets.chomp.to_i
  break if n == 0
  p_list = possibility_list n
  result = except_value(p_list)
  puts result
end