#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

#define NUM 100000

double dp[NUM+1][20];
double p[20];
double ruisekiwa[NUM+1];

int main(){

	p[0] = 1.0;
	for(int i = 1; i < 20; i++){
		p[i] = p[i-1]*0.5;
	}

	for(int i = 0; i <= NUM; i++){
		for(int k = 0; k < 20; k++){
			dp[i][k] = 0;
		}
	}

	dp[1][1] = 1.0;
	dp[2][0] = 0.5;
	dp[2][2] = 0.5;

	for(int day = 3; day <= NUM; day++){
		dp[day][1] += dp[day-1][0];

		for(int renzoku_num = 1; renzoku_num < 19; renzoku_num++){
			dp[day][renzoku_num+1] += dp[day-1][renzoku_num]*p[renzoku_num];
			dp[day][0] += dp[day-1][renzoku_num]*(1-p[renzoku_num]);
		}
		dp[day][0] += dp[day-1][19]*(1-p[19]);
	}

	ruisekiwa[0] = 0;
	for(int day = 1; day <= NUM; day++){
		ruisekiwa[day] = 0;
		for(int i = 1; i < 20; i++){
			ruisekiwa[day] += dp[day][i];
		}
		ruisekiwa[day] += ruisekiwa[day-1];
	}

	int N;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		printf("%.10lf\n",ruisekiwa[N]);
	}
}