public class Euler906 {

    static class KahanSum {
        double sum = 0.0;
        double c = 0.0;

        void add(double value) {
            double y = value - c;
            double t = sum + y;
            c = (t - sum) - y;
            sum = t;
        }
    }

    static double[] buildReciprocals(int n) {
        double[] inv = new double[n + 1];
        for (int i = 1; i <= n; ++i) {
            inv[i] = 1.0 / i;
        }
        return inv;
    }

    static double[] buildGValues(int n, double[] inv) {
        int N = n - 1;
        double[] G = new double[N + 1];
        G[0] = 1.0;
        for (int m = 1; m <= N; ++m) {
            double term = 1.0;
            double sum = 1.0;
            for (int c = 1; c <= m; ++c) {
                term *= (m - c + 1) * inv[N - c + 1];
                sum += term;
            }
            G[m] = sum;
        }
        return G;
    }

    public static String solve() {
        int n = 20000;
        if (n <= 1)
            return "1.0000000000";

        int N = n - 1;
        double[] inv = buildReciprocals(N);
        double[] G = buildGValues(n, inv);

        int threads = Math.max(1, Runtime.getRuntime().availableProcessors());
        double[] partial = new double[threads];
        Thread[] pool = new Thread[threads];

        int maxThreads = Math.min(threads, N + 1);
        int block = (N + 1 + maxThreads - 1) / maxThreads;

        for (int t = 0; t < maxThreads; ++t) {
            final int tIdx = t;
            final int start = t * block;
            final int end = Math.min(N + 1, start + block);

            if (start >= end)
                continue;

            pool[t] = new Thread(() -> {
                KahanSum local = new KahanSum();
                for (int a = start; a < end; ++a) {
                    double f = 1.0;
                    int maxB = N - a;
                    for (int b = 0; b <= maxB; ++b) {
                        int m = N - a - b;
                        local.add(f * G[m]);
                        if (b < maxB) {
                            f *= (N - a - b) * inv[N - b];
                        }
                    }
                }
                partial[tIdx] = local.sum;
            });
            pool[t].start();
        }

        try {
            for (int t = 0; t < maxThreads; t++) {
                if (pool[t] != null)
                    pool[t].join();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        KahanSum total = new KahanSum();
        for (double value : partial) {
            total.add(value);
        }

        double result = total.sum / ((double) n * n);
        return String.format(java.util.Locale.US, "%.10f", result);
    }

    public static void main(String[] args) {
        System.out.println(solve());
    }
}
