import java.util.Locale;

public class Euler683 {
    static double expectedRoundPayment(int m) {
        double[] den = new double[m];
        double[] mu = new double[m];

        for (int k = 1; k < m; ++k) {
            double th = 2.0 * Math.PI * k / m;
            double lam = 1.0 / 3.0 + (4.0 / 9.0) * Math.cos(th) + (2.0 / 9.0) * Math.cos(2.0 * th);
            den[k] = 1.0 - lam;
        }

        for (int k = 1; k < m; ++k) {
            double inv = 1.0 / den[k];
            double th = 2.0 * Math.PI * k / m;

            double bReal = Math.cos(th);
            double bImag = Math.sin(th);

            double cReal = 1.0;
            double cImag = 0.0;

            for (int d = 1; d < m; ++d) {
                double nr = cReal * bReal - cImag * bImag;
                double ni = cReal * bImag + cImag * bReal;
                cReal = nr;
                cImag = ni;

                mu[d] += (1.0 - cReal) * inv;
            }
        }

        double[] r = new double[m];
        double sum_r = 0.0;
        for (int d = 1; d < m; ++d) {
            r[d] = 2.0 * mu[d] - 1.0;
            sum_r += r[d];
        }
        r[0] = -sum_r;

        double sReal = 0.0;
        for (int k = 1; k < m; ++k) {
            double th = -2.0 * Math.PI * k / m;
            double bReal = Math.cos(th);
            double bImag = Math.sin(th);

            double cReal = 1.0;
            double cImag = 0.0;

            double rhReal = 0.0;
            double rhImag = 0.0;

            for (int d = 0; d < m; ++d) {
                rhReal += cReal * r[d];
                rhImag += cImag * r[d];

                double nr = cReal * bReal - cImag * bImag;
                double ni = cReal * bImag + cImag * bReal;
                cReal = nr;
                cImag = ni;
            }

            sReal += rhReal / den[k];
        }

        return -sReal / m;
    }

    public static String solve() {
        double acc = 0.0;
        for (int m = 2; m <= 500; ++m) {
            acc += expectedRoundPayment(m);
        }

        return String.format(Locale.US, "%.8e", acc).toLowerCase();
    }

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