import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;
 
void main() {
    int N;
    bool input() {
        scanf("%d\n", &N);
        return N != 0;
    }
    void solve() {
        auto Cache = new double[][](30, 30);
        auto Cached = new bool[][](30, 30);
        double dfs(int c, int n) {
            if (n >= min(N, 30)) return 0;
            if (Cached[c][n]) return Cache[c][n];
            double x = (1.0 / (1 << c));
            Cached[c][n] = true;
            return Cache[c][n] = x + x * dfs(c + 1, n + 1) + (1.0 - x) * dfs(0, n + 1);
        }
        writefln("%.5f", dfs(0, 0));
    }
    while (input) solve;
}