import math D1, D2 = map(int, input().split()) s = math.sqrt(D2) points = set() # Edge AB: x + y = s (from (s,0) to (0,s)) a = 2 b = -2 * s c = s**2 - D1 discriminant = b**2 - 4 * a * c if discriminant >= 0: sqrt_d = math.sqrt(discriminant) x1 = (-b + sqrt_d) / (2 * a) x2 = (-b - sqrt_d) / (2 * a) for x in [x1, x2]: if 0 <= x <= s: y = s - x x_round = round(x, 9) y_round = round(y, 9) points.add((x_round, y_round)) # Edge BC: x - y = -s (from (0,s) to (-s,0)) a = 2 b = 2 * s c = s**2 - D1 discriminant = b**2 - 4 * a * c if discriminant >= 0: sqrt_d = math.sqrt(discriminant) x1 = (-b + sqrt_d) / (2 * a) x2 = (-b - sqrt_d) / (2 * a) for x in [x1, x2]: if -s <= x <= 0: y = x + s x_round = round(x, 9) y_round = round(y, 9) points.add((x_round, y_round)) # Edge CD: x + y = -s (from (-s,0) to (0,-s)) a = 2 b = 2 * s c = s**2 - D1 discriminant = b**2 - 4 * a * c if discriminant >= 0: sqrt_d = math.sqrt(discriminant) x1 = (-b + sqrt_d) / (2 * a) x2 = (-b - sqrt_d) / (2 * a) for x in [x1, x2]: if -s <= x <= 0: y = -s - x x_round = round(x, 9) y_round = round(y, 9) points.add((x_round, y_round)) # Edge DA: x - y = s (from (0,-s) to (s,0)) a = 2 b = -2 * s c = s**2 - D1 discriminant = b**2 - 4 * a * c if discriminant >= 0: sqrt_d = math.sqrt(discriminant) x1 = (-b + sqrt_d) / (2 * a) x2 = (-b - sqrt_d) / (2 * a) for x in [x1, x2]: if 0 <= x <= s: y = x - s x_round = round(x, 9) y_round = round(y, 9) points.add((x_round, y_round)) # Check vertices if they lie on the circle if D1 == D2: vertices = [(s, 0), (0, s), (-s, 0), (0, -s)] for (x, y) in vertices: x_round = round(x, 9) y_round = round(y, 9) points.add((x_round, y_round)) print(len(points))