#!/usr/bin/env python3 from decimal import getcontext, Decimal # Proudly stolen from https://docs.python.org/3/library/decimal.html#recipes def pi(): """Compute Pi to the current precision. >>> print(pi()) 3.141592653589793238462643383 """ getcontext().prec += 2 # extra digits for intermediate steps three = Decimal(3) # substitute "three=3.0" for regular floats lasts, t, s, n, na, d, da = 0, three, 3, 1, 0, 0, 24 while s != lasts: lasts = s n, na = n + na, na + 8 d, da = d + da, da + 32 t = (t * n) / d s += t getcontext().prec -= 2 return +s # unary plus applies the new precision def sin(x): """Return the sine of x as measured in radians. The Taylor series approximation works best for a small value of x. For larger values, first compute x = x % (2 * pi). >>> print(sin(Decimal('0.5'))) 0.4794255386042030002732879352 >>> print(sin(0.5)) 0.479425538604 >>> print(sin(0.5+0j)) (0.479425538604+0j) """ getcontext().prec += 2 i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1 while s != lasts: lasts = s i += 2 fact *= i * (i - 1) num *= x * x sign *= -1 s += num / fact * sign # x^(2i+1) / (2i+1)! for i = 0..∞ getcontext().prec -= 2 return +s # Adapted `sin(x)` using the Taylor series of arcsin def asin(x): """Return the arcsine of x as measured in radians. The Taylor series approximation works best for a small value of x. For larger values, first compute x = x % (2 * pi). >>> print(sin(Decimal('0.5'))) 0.4794255386042030002732879352 >>> print(sin(0.5)) 0.479425538604 >>> print(sin(0.5+0j)) (0.479425538604+0j) """ getcontext().prec += 2 ii, i, lasts, s, num, fact2, exp, fact = 0, 0, 0, x, x, 1, 1, 1 while s != lasts: lasts = s ii += 2 i += 1 num *= x * x fact2 *= ii * (ii - 1) exp *= 4 fact *= i s += num * fact2 / exp / fact / fact / (ii + 1) # x^(2i+1) * (2i)! / 2^(2i) / (i!)^2 / (2i+1) for i = 0..∞ getcontext().prec -= 2 return +s getcontext().prec = 142 (n, e), pi_d = map(int, input().split()), pi() print(sum(1 if e > 2 * r else int(pi_d / asin(Decimal(e) / 2 / Decimal(r))) for r in map(int, input().split())))