// AOJ1056 Ben Toh

#include <iostream>

using namespace std;

int main(){
	int n;
	double dp[100001];
	dp[0] = 0.0; dp[1] = 1.0; dp[2] = 1.5;
	for(int i=3;i<=100000;i++){
		dp[i] = 0.0;
		double cur = 1.0, mul = 0.5;
		for(int j=2;j<=min(i,100);j++){
			dp[i] += cur*(1-mul)*(j-1+dp[i-j]);
			cur *= mul;
			mul *= 0.5;
		}
		if(i<=100) dp[i] += cur*i;
	}
	while(cin >> n, n){
		printf("%.2lf\n", dp[n]);
	}
}