#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int N = 1e5 + 10, N2 = 50;
double dp[N][N2];

const double EPS = 1e-3;

double p[N2];

double rec(int n, int i){
	if (n == 0) return 0;

	double &res = dp[n][i];
	if (res >= 0) return res;
	res = 0;
	if (i < N2 - 1) res += p[i] * (rec(n - 1, i + 1) + 1);
	res += (1 - p[i])*(rec(n - 1, 0));

	return res;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);

	p[0] = 1;
	rep(i, N2 - 1){
		p[i + 1] = p[i] * .5;
	}
	rep(i, N) rep(j, N2) dp[i][j] = -1;
	rep(i, 10) rec(i * 10000, 0);

	int n;
	while (cin >> n, n){
		cout << rec(n, 0) << endl;
	}

	return 0;
}