import java.util.Locale;

public class Euler255 {
    static long ceilDiv(long a, long b) {
        return (a + b - 1) / b;
    }

    static long totalIterations(long lo, long hi, long x) {
        if (lo > hi)
            return 0;

        long total = hi - lo + 1;

        long cmin = ceilDiv(lo, x);
        long cmax = ceilDiv(hi, x);
        long ymin = (x + cmin) / 2;
        long ymax = (x + cmax) / 2;

        for (long y = ymin; y <= ymax; ++y) {
            long cl = 2 * y - x;
            long ch = cl + 1;

            long fromVal = Math.max(cl, cmin);
            long toVal = Math.min(ch, cmax);
            if (fromVal > toVal)
                continue;

            long nl = (fromVal - 1) * x + 1;
            long nr = toVal * x;
            if (nl < lo)
                nl = lo;
            if (nr > hi)
                nr = hi;

            if (y == x)
                continue;
            total += totalIterations(nl, nr, y);
        }

        return total;
    }

    static double averageIterationsForDigits(int d) {
        long lo = 1;
        for (int i = 1; i < d; ++i)
            lo *= 10;
        long hi = lo * 10 - 1;

        long p10 = 1;
        int exp = (d % 2 == 1) ? ((d - 1) / 2) : ((d - 2) / 2);
        for (int i = 0; i < exp; ++i)
            p10 *= 10;

        long x0 = (d % 2 == 1) ? (2 * p10) : (7 * p10);
        long tot = totalIterations(lo, hi, x0);
        long cnt = hi - lo + 1;

        return (double) tot / (double) cnt;
    }

    public static String solve() {
        double ans = averageIterationsForDigits(14);
        return String.format(Locale.US, "%.10f", ans);
    }

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