public class Euler737 {
    static final double kPi = 3.141592653589793238462643383279502884;

    static double harmonicApprox(double n) {
        double n2 = n * n;
        return Math.log(n) + 0.5772156649 + 1.0 / (2.0 * n) - 1.0 / (12.0 * n2) +
                1.0 / (120.0 * n2 * n2) - 1.0 / (252.0 * n2 * n2 * n2);
    }

    static double tanPhi(double n, double hn) {
        return Math.sqrt(n / hn - 0.25) / (n + 0.5);
    }

    static double atanPoly(double x) {
        double x2 = x * x;
        return x - x * x2 / 3.0 + x * x2 * x2 / 5.0;
    }

    static double integralBlock(double k, double f_n, double f_n_der2) {
        return 2.0 * k * f_n + f_n_der2 * k * k * k / 3.0;
    }

    static long coinsNeededExact(long loops) {
        double target = 2.0 * kPi * loops;
        double harmonic = 1.0;
        double radius = 1.0;
        double tanGamma = 0.0;
        double accumulated = 0.0;
        long n = 1;

        while (accumulated <= target) {
            double r2 = radius * radius;
            double root = Math.sqrt(4.0 - r2);
            double tanBeta = root / radius;
            double tanTheta = (tanBeta - tanGamma) / (1.0 + tanBeta * tanGamma);
            accumulated += Math.atan(tanTheta);

            double nl = (double) n;
            tanGamma = (nl * radius * root) / (nl * r2 + 2.0);

            long m = n + 1;
            harmonic += 1.0 / m;
            radius = Math.sqrt(harmonic / m);
            n++;
        }

        return n;
    }

    static long coinsNeededApprox(long loops) {
        double totalAngle = -0.16103076705762 / 180.0 * kPi;
        long n = 0;
        double harmonic = 0.0;
        long initial = 1000000;
        long k = 20000;

        for (long i = 0; i < initial; ++i) {
            n++;
            harmonic += 1.0 / n;
            totalAngle += atanPoly(tanPhi(n, harmonic));
        }

        long center = n + k + 1;
        double blockSum = 0.0;
        double stage1Target = loops * 2.0 * kPi - kPi / 2.0;

        while (totalAngle < stage1Target) {
            double fnm2k = atanPoly(tanPhi(center - 2 * k, harmonicApprox(center - 2.0 * k)));
            double fnmk = atanPoly(tanPhi(center - k, harmonicApprox(center - 1.0 * k)));
            double fn = atanPoly(tanPhi(center, harmonicApprox(center)));
            double fnpk = atanPoly(tanPhi(center + k, harmonicApprox(center + 1.0 * k)));
            double fnp2k = atanPoly(tanPhi(center + 2 * k, harmonicApprox(center + 2.0 * k)));

            double fnDer2 = (fnpk + fnmk - 2.0 * fn) / (k * k);
            double fnpkDer = (-fn + fnp2k) / (2.0 * k);
            double fnmkDer = (fn - fnm2k) / (2.0 * k);

            blockSum = integralBlock(k, fn, fnDer2) + (fnmk + fnpk) / 2.0 + (fnpkDer - fnmkDer) / 12.0;

            totalAngle += blockSum;
            center += 2 * k + 1;
        }

        center -= 2 * k + 1;
        totalAngle -= blockSum;
        n = center - k;
        harmonic = harmonicApprox(n);

        double dTheta = Math.atan(Math.sqrt(4.0 * n / harmonic - 1.0));
        double dPhi = atanPoly(tanPhi(n, harmonic));
        double stage2Target = loops * 2.0 * kPi;

        while (totalAngle + dTheta < stage2Target) {
            totalAngle += dPhi;
            n++;
            harmonic += 1.0 / n;
            dPhi = atanPoly(tanPhi(n, harmonic));
            dTheta = Math.atan(Math.sqrt(4.0 * n / harmonic - 1.0));
        }

        return n + 1;
    }

    public static String solve() {
        return Long.toString(coinsNeededApprox(2020));
    }

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