#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

static int n;

double calc(int day, int win)
{
	static const int cut = 30;
	static double memo[100001][cut];
	
	if(day == 0)
		for(int i = 0; i < n; ++i)
			for(int j = 0; j < cut; ++j)
				memo[i][j] = -1;
	
	double ret = 0;
	double per = 1.0 / (1 << win);
	
	if(n == day || win >= cut)
		return 0;
		
	if(memo[day][win] != -1)
		return memo[day][win];
	
	ret += (calc(day + 1, win + 1) + 1) * per;
	ret += calc(day + 1, 0) * (1 - per);
	
	return memo[day][win] = ret;
}

int main()
{
	while(true) {
		
		scanf("%d", &n);
		
		if(n == 0)
			break;
		
		printf("%f\n", calc(0, 0));
	}
	
	return 0;
}