import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Locale;

public class Euler483 {

    private static int gcdInt(int a, int b) {
        while (b != 0) {
            int temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private static int lcmInt(int a, int b) {
        return (a / gcdInt(a, b)) * b;
    }

    private static double gValue(int n) {
        int[] largestPrimeFactor = new int[n + 1];
        for (int p = 2; p <= n; ++p) {
            if (largestPrimeFactor[p] != 0)
                continue;
            for (int v = p; v <= n; v += p) {
                largestPrimeFactor[v] = p;
            }
        }

        List<Map<Integer, Double>> histograms = new ArrayList<>(n + 1);
        double count = 1.0;
        for (int i = 0; i <= n; ++i) {
            Map<Integer, Double> map = new HashMap<>();
            if (i > 0)
                count /= i;
            map.put(1, count);
            histograms.add(map);
        }

        for (int p = n; p >= 2; --p) {
            if (largestPrimeFactor[p] != p)
                continue;

            for (int c = p; c <= n; c += p) {
                if (largestPrimeFactor[c] != p)
                    continue;

                List<Map<Integer, Double>> next = new ArrayList<>(n + 1);
                for (int i = 0; i <= n; ++i) {
                    next.add(new HashMap<>());
                }

                double countRhs = 1.0;
                for (int multiplicity = 0; multiplicity * c <= n; ++multiplicity) {
                    if (multiplicity > 0) {
                        countRhs /= (double) c * multiplicity;
                    }

                    int rhsLen = multiplicity * c;
                    int rhsLcm = (multiplicity == 0) ? 1 : c;

                    for (int lhsLen = 0; lhsLen + rhsLen <= n; ++lhsLen) {
                        int total = lhsLen + rhsLen;
                        Map<Integer, Double> h = histograms.get(lhsLen);
                        Map<Integer, Double> nh = next.get(total);

                        for (Map.Entry<Integer, Double> entry : h.entrySet()) {
                            int l = lcmInt(entry.getKey(), rhsLcm);
                            double addedVal = entry.getValue() * countRhs;
                            nh.put(l, nh.getOrDefault(l, 0.0) + addedVal);
                        }
                    }
                }
                histograms = next;
            }

            for (int len = 0; len <= n; ++len) {
                Map<Integer, Double> h = histograms.get(len);
                Map<Integer, Double> squashed = new HashMap<>();

                for (Map.Entry<Integer, Double> entry : h.entrySet()) {
                    int l = entry.getKey();
                    double cVal = entry.getValue();
                    while (l % p == 0) {
                        l /= p;
                        cVal *= (double) p * p;
                    }
                    squashed.put(l, squashed.getOrDefault(l, 0.0) + cVal);
                }
                histograms.set(len, squashed);
            }
        }

        double ans = 0.0;
        for (Map.Entry<Integer, Double> entry : histograms.get(n).entrySet()) {
            double l = entry.getKey();
            ans += l * l * entry.getValue();
        }
        return ans;
    }

    public static void main(String[] args) {
        double ans = gValue(350);
        System.out.printf(Locale.US, "%.9e\n", ans);
    }
}
