#include <bits/stdc++.h>
using namespace std;

const int INF = 1000000007;
const int MOD = 1000000007;


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

const int PRC = 30;

double dp[100001][PRC + 1];
double e[100001];

int main(){
    for(int i = 0; i <= 100000; i++){
        fill(dp[i], dp[i] + PRC + 1, 0);
    }
    dp[0][0] = 1;
    for(int i = 0; i < 100000; i++){
        for(int j = 0; j < PRC; j++){
            dp[i + 1][j + 1] += dp[i][j] / pow(2, j);
            dp[i + 1][0] += dp[i][j] * (1 - 1 / pow(2, j));
        }
    }
    e[0] = 0;
    for(int i = 1; i <= 100000; i++){
        e[i] = e[i-1];
        for(int j = 0; j < PRC; j++){
            e[i] += dp[i-1][j] / pow(2, j);
        }
    }
    while(true){
        int n;
        scanf("%d", &n);
        if(n == 0) break;
        printf("%.12f\n", e[n]);
    }
    return 0;
}