Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust.

The pizza is a circle of radius r and center at the origin. Pizza consists of the main part — circle of radius r - d with center at the origin, and crust around the main part of the width d. Pieces of sausage are also circles. The radius of the i -th piece of the sausage is r_{i}, and the center is given as a pair (x_{i}, y_{i}).

Gleb asks you to help determine the number of pieces of sausage caught on the crust. A piece of sausage got on the crust, if it completely lies on the crust.


-----Input-----

First string contains two integer numbers r and d (0 ≤ d < r ≤ 500) — the radius of pizza and the width of crust.

Next line contains one integer number n — the number of pieces of sausage (1 ≤ n ≤ 10^5).

Each of next n lines contains three integer numbers x_{i}, y_{i} and r_{i} ( - 500 ≤ x_{i}, y_{i} ≤ 500, 0 ≤ r_{i} ≤ 500), where x_{i} and y_{i} are coordinates of the center of i-th peace of sausage, r_{i} — radius of i-th peace of sausage.


-----Output-----

Output the number of pieces of sausage that lay on the crust.


-----Examples-----
Input
8 4
7
7 8 1
-7 3 2
0 2 1
0 -2 2
-3 -3 1
0 6 2
5 3 1

Output
2

Input
10 8
4
0 0 9
0 0 10
1 0 1
1 0 2

Output
0



-----Note-----

Below is a picture explaining the first example. Circles of green color denote pieces of sausage lying on the crust.

 [Image]

Difficulty: interview

Starter code:

Solutions:
R=lambda:list(map(int,input().split()))
r,d=R()
def ok():
  x,y,z=R()
  return 1 if (r-d+z)**2<=x*x+y*y<=(r-z)**2 else 0
print(sum(ok() for i in range(int(input()))))


read = lambda: map(int, input().split())
R, d = read()
n = int(input())
cnt = 0
for i in range(n):
    x, y, r = read()
    p = (x ** 2 + y ** 2) ** 0.5
    if p - r >= R - d and p + r <= R:
        cnt += 1
print(cnt)

r,d=list(map(int,input().split()))
count=0
for i in range(int(input())):
    x,y,r1 = list(map(int,input().split()))
    k = (x*x+y*y)**0.5
    if (k-r1)>=(r-d) and (k+r1)<=r:
        count+=1
print(count)


from sys import stdin, stdout

r,d = list(map(int,stdin.readline().rstrip().split()))
n = int(stdin.readline().rstrip())
crust = 0

for _ in range(n):
    x,y,ri = list(map(int,stdin.readline().rstrip().split()))
    z = (x**2+y**2)**0.5
    if z-ri>=(r-d) and z+ri<=r:
        crust+=1

print(crust)


r,d=map(int,input().split())
r-=d
n=int(input())
k=0
for _ in range(n):
    x,y,h=map(int,input().split())
    l=(x**2+y**2)**(1/2)
    if l-h>=r and l+h<=r+d:
        k+=1
print(k)

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
def incrust(d,r,dist):
    return r-d <= dist and dist <= r 
    
from math import sqrt    
    
r,d = map_input()
n = int(input())
ans = 0
for i in range(n):
    x,y,z = map_input()
    if incrust(d,r,sqrt(x**2+y**2)+z) and incrust(d,r,sqrt(x**2+y**2)-z):
        ans += 1 
        # print(i)
print(ans)    

from sys import stdin
from math import hypot
r, d = [int(i) for i in stdin.readline().split()]
r1 = r - d
n = int(stdin.readline())
ans = 0
eps = 0.0000001

def ge0(a):
    return (a >= 0 or abs(a) <= eps)

for i in range(n):
    x, y, r2 = [int(i) for i in stdin.readline().split()]
    d = hypot(x, y)
    if ge0(d - r1 - r2) and ge0(r - d - r2):
        ans += 1

print(ans)
    


from sys import stdin
from math import sqrt

r, d = list(map(int, stdin.readline().split()))
n = int(stdin.readline())
data = []
for i in range(0, n):
    data.append(list(map(int, stdin.readline().split())))

rs = 0
for i in range(0, n):
    D = sqrt(data[i][0] ** 2 + data[i][1] ** 2)
    rs += 1 if (r - d <= D - data[i][2] and r >= D + data[i][2]) else 0

print(rs)


from math import *
import itertools as it
from collections import *

EPS = 1e-9
def get_int()   : return int(input().strip())
def get_string(): return input().strip()
def get_array() : return list(map(int, input().strip().split(' ')))

def print_array(a, glue = ' '):
    print(glue.join(map(str, a)))

def print_grid(grid, glue = ' '):
    for row in grid:
        print_array(row, glue)

#====================================#

def solve():
    R, D = get_array()
    n = get_int()
    r = []
    cnt = 0
    for i in range(n):
        x, y, z = get_array()
        d = sqrt(x ** 2 + y ** 2)
        if d + z <= R and d - z >= R- D:
            cnt += 1
    return cnt
    

ntest = 1
# ntest = get_int()
for _ in range(ntest):
    print(solve())


3

def read_ints():
	return [int(i) for i in input().split()]

r, d = read_ints()
n = int(input())
cnt = 0
for i in range(n):
	x, y, r_i = read_ints()
	if (
		x ** 2 + y ** 2 >= (r - d + r_i) ** 2
		and x ** 2 + y ** 2 <= (r - r_i) ** 2
	):
		cnt += 1

print(cnt)

R, d = list(map(int, input().split(" ")))
n = int(input())

caught = 0

for i in range(n):

    x,y,r = list(map(int, input().split(" ")))

    if (R-d+r)*(R-d+r) <= x*x+y*y and x*x+y*y <= (R-r)*(R-r):

        caught +=1

print(caught)



r, d = list(map(int, input().split()))
n = int(input())
ans = 0
for _ in range(n):
    xi, yi, ri = list(map(int, input().split()))
    if (r - d + ri)**2 <= xi**2 + yi**2 and xi**2 + yi**2 <= (r - ri)**2:
        ans += 1
print(ans)


# your code goes here
import math
arr = input().split()
r = int(arr[0])
d = int(arr[1])

n = int(input())
ctr = 0
for i in range(n):
	arr = input().split()
	x = int(arr[0])
	y = int(arr[1])
	z = int(arr[2])
	
	x = abs(x)
	y = abs(y)
	
	l = math.sqrt(x*x + y*y)
	l -= z
	m = l + z + z
	if l >= r-d and m <= r:
		ctr += 1
print(str(ctr))

import math
r, d = map(int, input().split())
n = int(input())
c = 0
for i in range(n):
    x, y, z = map(int, input().split())
    if math.sqrt(x**2 + y**2) - z >= r - d and math.sqrt(x**2 + y**2) + z <= r:
        c += 1
print(c)

from sys import stdin, stdout 
from math import sqrt

def main():
    rayon, croute = map(int, stdin.readline().split())
    nbSaus = int(stdin.readline())
    diff = rayon-croute
    total = 0
    for _ in range(nbSaus):
        x, y, r = map(int, stdin.readline().split())
        dist = sqrt(x**2+y**2)
        distMin = dist-r
        distMax = dist+r 
        if distMin>=diff and distMax>=diff and distMin<=rayon and distMax<=rayon:
            total+=1
              
        
    stdout.write(str(total)) 
    
main()

from math import sqrt
r,d = map(int, input().split())
n = int(input())

ans = 0
for i in range(n):
    x,y,c = map(int, input().split())
    if max(sqrt(x**2 + y**2) - c, 0) >= (r-d) and sqrt(x**2 + y**2) + c <= r:
        ans += 1
print(ans)

R,D = map(int,input().split())
D = R-D
n = int(input())

from math import sqrt

cnt = 0
for i in range(n):
  x,y,r = map(int,input().split())

  p = x*x+y*y
  if (D+r)**2 <= p <= (R-r)**2:
    cnt += 1

print(cnt)


r, d = list(map(int, input().split()))
n = int(input())
counter = 0
for i in range(n):
    x,y,r_k = list(map(int, input().split()))
    if (x**2 + y**2)**(1.0/2.0) - r_k >= r-d and (x**2 + y**2)**(1.0/2.0) + r_k <= r:
        counter += 1
print(counter)



ls=list(map(int,input().split()))
r=ls[0]
d=ls[1]
n=int(input())
ans=0
for i in range(n):
    l=list(map(int,input().split()))
    x=l[0]
    y=l[1]
    rd=l[2]
    ds=(((abs(x)**2)+(abs(y)**2))**0.5)
    if ds-rd>=r-d and ds+rd<=r:
        ans+=1
print(ans)


radius, width = input().split()
radius, width = int(radius), int(width)

sausages = int(input())
count = 0

for _ in range(sausages):
    x, y, r = input().split()
    x, y, r = int(x), int(y), int(r)

    dist = (x**2 + y**2)**0.5

    if ((dist - r) >= radius - width) and ((dist + r) <= radius):
        count += 1

print(count)


r,d=map(int,input().split())
n=int(input())
k=0
for i in range(n):
	x,y,w=map(int,input().split())
	l=(x**2+y**2)**(1/2)
	if l-w>=r-d and l+w<=r:
		k+=1
print(k)

q,w=list(map(int,input().split()))
e=0
r=q-w
for i in range(0,int(input())):
    a,s,d=list(map(int,input().split()))
    f=(a*a+s*s)**0.5
    if ((f+d<=q)&(f-d>=r)):
        e+=1
print(e)


from math import sqrt

def dist(x1, y1):
    return sqrt(x1*x1 + y1*y1)



r, d = list(map(int, input().split()))
n = int(input())
res = 0
for i in range(n):
    x, y, i = list(map(int, input().split()))
    if((dist(x, y) - i) >= (r - d)) and ((dist(x, y) + i) <= r):
        res+=1
print(res)


from sys import stdin
import math

def distance(x,y):
	return abs(math.sqrt(x*x+y*y)) 

def check(x,y,rad):
	dist = distance(x,y)
	if((dist+rad)<=r and dist-rad>=(r-d)):
		return True
	else:
		return False


r,d=list(map(int,input().split()))
n=int(input())
count=0
for u in range(n):
	x,y,rad=list(map(int,input().split()))
	if(check(x,y,rad)):
		count+=1
print(count)

R, d = list(map(int, input().split()))
n = int(input())
cnt = 0
for _ in range(n):
    x, y, r = list(map(int, input().split()))
    s = (x**2 + y**2)**(1/2)
    if s + r <= R and s - r >= R - d:
        cnt += 1
print(cnt)