public class Euler199 {
    static double fillGap(double k1, double k2, double k3, int depth) {
        if (depth == 0)
            return 0;
        double k4 = k1 + k2 + k3 + 2 * Math.sqrt(k1 * k2 + k2 * k3 + k3 * k1);
        double area = Math.PI / (k4 * k4);
        return area + fillGap(k1, k2, k4, depth - 1) + fillGap(k1, k3, k4, depth - 1) + fillGap(k2, k3, k4, depth - 1);
    }

    public static void main(String[] args) {
        int depth = 10;
        double k = 1 + 2 / Math.sqrt(3);
        double r = 1 / k;
        double covered = 3 * Math.PI * r * r;
        covered += fillGap(k, k, k, depth);
        covered += 3 * fillGap(-1, k, k, depth);
        System.out.printf("%.8f%n", 1 - covered / Math.PI);
    }
}
