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;
    }
    auto dp = new double[][](31, 100001);
    void solve() {
        foreach (ref l; dp) l[] = 0;
        for (int n = N - 1; n >= 0; n--) {
            for (int c = 0; c < 30; c++) {
                double x = (1.0 / (1 << c));
                dp[c][n] = x + x * dp[c + 1][n + 1] + (1.0 - x) * dp[0][n + 1];
            }
        }
        writefln("%.5f", dp[0][0]);
    }
    while (input) solve;
}