
class BentoPossibility
  attr_accessor :last, :count, :p, :total_p

  def initialize
    @p = 0.5
    @total_p = 1
    @count = 1
    @last = true
  end

  def success
    result = self.clone
    result.p = @p / 2
    result.total_p = @total_p * @p
    result.count += 1
    result.last = true
    result
  end

  def fail
    result = self.clone
    result.p = 1.0
    result.total_p = @total_p * (1 - @p)
    result.last = false
    result
  end

  def except
    @count * @total_p
  end
end


def possibility_list(n)
  bentoes = [BentoPossibility.new]
  (n - 1).times {|n| bentoes = bentoes.map{|b| b.last ? [b.success, b.fail] : [b.success]}.flatten(1) }
  bentoes
end


while n = gets.chomp.to_i
  break if n == 0
  result = possibility_list(n).reduce(0) {|sum, b| sum + b.except}
  p result
end