import sys
import math
def cross(o, p, q):
return (p[0] - o[0]) * (q[1] - o[1]) - (p[1] - o[1]) * (q[0] - o[0])
def convex_hull(pts):
pts = sorted(set(pts))
if len(pts) < 3:
return pts
lower = []
for p in pts:
while len(lower) >= 2 and cross(lower[-2], lower[-1], p) <= 0:
lower.pop()
lower.append(p)
upper = []
for p in reversed(pts):
while len(upper) >= 2 and cross(upper[-2], upper[-1], p) <= 0:
upper.pop()
upper.append(p)
return lower[:-1] + upper[:-1]
def projections(t):
c, s = math.cos(t), math.sin(t)
u = [x * c + y * s for x, y in hull]
v = [y * c - x * s for x, y in hull]
return u, v
def square_side(t):
u, v = projections(t)
return max(max(u) - min(u), max(v) - min(v))
data = sys.stdin.read().split()
a = float(data[0])
n = int(data[1])
hull = convex_hull([(float(data[2 + 2 * i]), float(data[3 + 2 * i])) for i in range(n)])
m = len(hull)
quarter = math.pi / 2
angles = []
for i in range(m):
x1, y1 = hull[i]
x2, y2 = hull[(i + 1) % m]
angles.append(math.atan2(y2 - y1, x2 - x1) % quarter)
angles.sort()
angles.append(angles[0] + quarter)
best = square_side(0.0)
for i in range(m):
lo, hi = angles[i], angles[i + 1]
best = min(best, square_side(lo))
if hi - lo < 1e-12:
continue
u, v = projections((lo + hi) / 2)
p1, q1 = hull[u.index(max(u))], hull[u.index(min(u))]
p2, q2 = hull[v.index(max(v))], hull[v.index(min(v))]
A = (p1[0] - q1[0]) - (p2[1] - q2[1])
B = (p1[1] - q1[1]) + (p2[0] - q2[0])
if A == 0 and B == 0:
continue
t = lo + (math.atan2(-A, B) - lo) % math.pi
if t <= hi:
best = min(best, square_side(t))
print(1 if best <= a + 1e-9 else 0)