import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;

public class Euler776 {

    static class Stats {
        BigInteger count = BigInteger.ZERO;
        BigInteger sum = BigInteger.ZERO;
    }

    public static String fOfU64(long n) {
        String s = Long.toString(n);
        int L = s.length();
        int maxSum = 9 * L;

        Stats[] tight = new Stats[maxSum + 1];
        Stats[] loose = new Stats[maxSum + 1];
        for (int i = 0; i <= maxSum; i++) {
            tight[i] = new Stats();
            loose[i] = new Stats();
        }

        tight[0].count = BigInteger.ONE;
        BigInteger ten = BigInteger.TEN;

        for (int pos = 0; pos < L; ++pos) {
            int limit = s.charAt(pos) - '0';
            Stats[] ntight = new Stats[maxSum + 1];
            Stats[] nloose = new Stats[maxSum + 1];
            for (int i = 0; i <= maxSum; i++) {
                ntight[i] = new Stats();
                nloose[i] = new Stats();
            }

            for (int sum = 0; sum <= maxSum; ++sum) {
                if (tight[sum].count.compareTo(BigInteger.ZERO) != 0) {
                    for (int d = 0; d <= limit; ++d) {
                        int ns = sum + d;
                        Stats dst = (d == limit) ? ntight[ns] : nloose[ns];
                        dst.count = dst.count.add(tight[sum].count);
                        BigInteger addSum = tight[sum].sum.multiply(ten)
                                .add(tight[sum].count.multiply(BigInteger.valueOf(d)));
                        dst.sum = dst.sum.add(addSum);
                    }
                }

                if (loose[sum].count.compareTo(BigInteger.ZERO) != 0) {
                    for (int d = 0; d <= 9; ++d) {
                        int ns = sum + d;
                        Stats dst = nloose[ns];
                        dst.count = dst.count.add(loose[sum].count);
                        BigInteger addSum = loose[sum].sum.multiply(ten)
                                .add(loose[sum].count.multiply(BigInteger.valueOf(d)));
                        dst.sum = dst.sum.add(addSum);
                    }
                }
            }

            tight = ntight;
            loose = nloose;
        }

        MathContext mc = new MathContext(100);
        BigDecimal ans = BigDecimal.ZERO;

        for (int sum = 1; sum <= maxSum; ++sum) {
            BigInteger totalSum = tight[sum].sum.add(loose[sum].sum);
            if (totalSum.equals(BigInteger.ZERO))
                continue;

            BigDecimal term = new BigDecimal(totalSum).divide(new BigDecimal(sum), mc);
            ans = ans.add(term, mc);
        }

        // Format to scientific notation with 12 decimal places
        // The format %e inherently uses 6 decimal places by default, so %.12e is used
        return String.format(java.util.Locale.US, "%.12e", ans);
    }

    public static String solve() {
        return fOfU64(1234567890123456789L);
    }

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