import java.util.*;

public class Euler253 {
    static class State implements Comparable<State> {
        int[] pieces;
        int hash;

        State(int[] pieces) {
            this.pieces = pieces;
            this.hash = Arrays.hashCode(pieces);
        }

        @Override
        public int hashCode() {
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null || getClass() != obj.getClass())
                return false;
            State other = (State) obj;
            return Arrays.equals(this.pieces, other.pieces);
        }

        @Override
        public int compareTo(State o) {
            if (this.pieces.length != o.pieces.length)
                return Integer.compare(this.pieces.length, o.pieces.length);
            for (int i = 0; i < this.pieces.length; ++i) {
                if (this.pieces[i] != o.pieces[i])
                    return Integer.compare(this.pieces[i], o.pieces[i]);
            }
            return 0;
        }
    }

    static class Transition {
        State nextState;
        int weight;

        Transition(State nextState, int weight) {
            this.nextState = nextState;
            this.weight = weight;
        }
    }

    static State makeNext(State s, int removeLen, int add1, int add2) {
        int[] old = s.pieces;
        int[] next = new int[old.length + (add1 > 0 ? 1 : 0) + (add2 > 0 ? 1 : 0) - 1];

        boolean removed = false;
        int idx = 0;
        for (int x : old) {
            if (!removed && x == removeLen) {
                removed = true;
            } else {
                next[idx++] = x;
            }
        }
        if (add1 > 0)
            next[idx++] = add1;
        if (add2 > 0)
            next[idx++] = add2;

        Arrays.sort(next);
        return new State(next);
    }

    static Map<State, List<Transition>> transMemo = new HashMap<>();

    static List<Transition> getTransitions(State s) {
        if (transMemo.containsKey(s))
            return transMemo.get(s);

        Map<State, Integer> acc = new HashMap<>();
        int blocks = s.pieces.length;
        int i = 0;

        while (i < blocks) {
            int j = i;
            while (j < blocks && s.pieces[j] == s.pieces[i])
                ++j;
            int cnt = j - i;
            int length = s.pieces[i];

            if (length == 1) {
                State t = makeNext(s, 1, 0, 0);
                acc.put(t, acc.getOrDefault(t, 0) + cnt);
            } else {
                State endpoint = makeNext(s, length, length - 1, 0);
                acc.put(endpoint, acc.getOrDefault(endpoint, 0) + 2 * cnt);
                for (int a = 1; a <= length - 2; ++a) {
                    int b = length - 1 - a;
                    State split = makeNext(s, length, a, b);
                    acc.put(split, acc.getOrDefault(split, 0) + cnt);
                }
            }
            i = j;
        }

        List<Transition> out = new ArrayList<>(acc.size());
        for (Map.Entry<State, Integer> entry : acc.entrySet()) {
            out.add(new Transition(entry.getKey(), entry.getValue()));
        }
        transMemo.put(s, out);
        return out;
    }

    static Map<State, double[]> memo = new HashMap<>();

    static double expectedMax(State s, int currentMax) {
        if (s.pieces.length == 0)
            return (double) currentMax;

        double[] row = memo.get(s);
        if (row == null) {
            row = new double[41];
            Arrays.fill(row, Double.NaN);
            memo.put(s, row);
        }

        if (!Double.isNaN(row[currentMax]))
            return row[currentMax];

        int remaining = 0;
        for (int x : s.pieces)
            remaining += x;

        List<Transition> tr = getTransitions(s);
        double ans = 0.0;

        for (Transition t : tr) {
            int nextMax = Math.max(currentMax, t.nextState.pieces.length);
            ans += ((double) t.weight / remaining) * expectedMax(t.nextState, nextMax);
        }

        row[currentMax] = ans;
        return ans;
    }

    public static String solve() {
        State start = new State(new int[] { 40 });
        double ans = expectedMax(start, 1);
        return String.format(Locale.US, "%.6f", ans);
    }

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