import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;

public class Euler226 {
    static long prefixPopcount(long n) {
        long total = 0;
        for (int bit = 0; bit < 63; ++bit) {
            long half = 1L << bit;
            if (half >= n)
                break;
            long cycle = half << 1;
            long full = n / cycle;
            long rem = n % cycle;
            total += full * half;
            if (rem > half) {
                total += rem - half;
            }
        }
        return total;
    }

    static double overlapHeight(double x, double curveY) {
        double dx = x - 0.25;
        double inside = 0.0625 - dx * dx;
        if (inside <= 0.0)
            return 0.0;

        double dy = Math.sqrt(inside);
        double circleLow = 0.5 - dy;
        double circleHigh = 0.5 + dy;
        double lo = Math.max(0.0, circleLow);
        double hi = Math.min(circleHigh, curveY);
        return hi > lo ? hi - lo : 0.0;
    }

    static class PartialSums {
        double oddSum = 0.0;
        double evenSum = 0.0;
    }

    public static String solve() {
        double eps = 2e-9;
        int minLevel = 22;
        int maxLevel = 28;
        int threads = Math.max(1, Runtime.getRuntime().availableProcessors());

        double previous = simpsonLevel(minLevel, threads);
        for (int level = minLevel + 1; level <= maxLevel; ++level) {
            double current = simpsonLevel(level, threads);
            if (Math.abs(current - previous) < eps) {
                return String.format(java.util.Locale.US, "%.8f", current);
            }
            previous = current;
        }
        return String.format(java.util.Locale.US, "%.8f", previous);
    }

    static double simpsonLevel(int level, int numThreads) {
        long denom = 1L << level;
        long steps = denom >> 1;
        if (steps < 2)
            return 0.0;

        long interior = steps - 1;
        if (interior == 0)
            return 0.0;

        int threads = (int) Math.min(numThreads, interior);
        long chunk = (interior + threads - 1) / threads;

        ExecutorService executor = Executors.newFixedThreadPool(threads);
        List<Future<PartialSums>> futures = new ArrayList<>();

        for (int t = 0; t < threads; ++t) {
            final long begin = 1 + t * chunk;
            final long end = Math.min(steps, begin + chunk);
            if (begin >= end)
                continue;

            futures.add(executor.submit(() -> {
                PartialSums p = new PartialSums();
                double invDenom = 1.0 / denom;
                double numer = (double) level * begin - 2.0 * prefixPopcount(begin);

                for (long i = begin; i < end; ++i) {
                    double x = i * invDenom;
                    double curveY = numer * invDenom;
                    double fx = overlapHeight(x, curveY);

                    if ((i & 1) != 0) {
                        p.oddSum += fx;
                    } else {
                        p.evenSum += fx;
                    }

                    numer += level - 2 * Long.bitCount(i);
                }
                return p;
            }));
        }

        double oddSum = 0.0;
        double evenSum = 0.0;

        for (Future<PartialSums> f : futures) {
            try {
                PartialSums p = f.get();
                oddSum += p.oddSum;
                evenSum += p.evenSum;
            } catch (Exception e) {
            }
        }
        executor.shutdown();

        double h = 1.0 / denom;
        double f0 = 0.0;
        double fn = overlapHeight(0.5, 0.5);
        return h * (f0 + fn + 4.0 * oddSum + 2.0 * evenSum) / 3.0;
    }

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