We need to determine the color of a point (x, y) on this infinite chessboard-like pattern described? The problem: "The magic clock can be represented as an infinite Cartesian plane, where the origin corresponds to the clock center. The clock was painted two colors as is shown in the picture: The picture shows only the central part of the clock. This coloring naturally extends to infinity." Then: "All the points located on the border of one of the areas have to be considered painted black." And: "All the points between which and the origin of coordinates the distance is integral-value are painted black."
We need to parse. There's a picture (not provided). The description: "The magic clock was painted two colors as is shown in the picture:" Then there is a picture (presumably a checkerboard-like pattern with radial borders). Then: "All the points located on the border of one of the areas have to be considered painted black." And: "All the points between which and the origin of coordinates the distance is integral-value are painted black."
So we need to understand the coloring. Typically such problems involve an infinite grid of squares? Or maybe it's about the coloring like a chessboard? But there is mention of distances integral value being black borders.
Wait, maybe the clock is divided into alternating black and white regions, maybe like concentric rings? But the picture might be something like a checkerboard pattern on the plane? However the text says: "All the points between which and the origin of coordinates the distance is integral-value are painted black." That suggests that any point whose Euclidean distance from the origin is an integer is considered black. That is a set of circles (boundaries). And also "All the points located on the border of one of the areas have to be considered painted black." This could mean that the boundaries between areas (like lines) are black. So the plane is divided into regions (like cells), and borders of those cells are black. And also any point whose distance from origin is an integer is black.
We need to interpret the picture: "The magic clock can be represented as an infinite Cartesian plane, where the origin corresponds to the clock center. The clock was painted two colors as is shown in the picture: The picture shows only the central part of the clock. This coloring naturally extends to infinity." Possibly the picture is like a radial grid? Could be a combination of circles (at integer radii) and rays (lines at angles multiples of something) dividing the plane into regions colored alternately. But the problem mentions only two colors. And we need to output black or white for a given point.
Perhaps it's a known problem: "Magic Clock" from Codeforces? Let's search memory. There is a Codeforces problem: "C. Magic Clock"? Not sure. Could be from e-olymp? Actually, I recall a problem "Magic Clock" from the contest (maybe ACM). Could be that the clock is painted like a chessboard of squares of size 1? But then they talk about distance integral-value being black.
Let's read the description again: "All the points between which and the origin of coordinates the distance is integral-value are painted black." That sentence is ambiguous: maybe it means: "All points for which the distance to the origin is an integer are painted black." So circles of radius integer are black. And also borders of areas are black. So the interior of areas are either white or maybe black? But they say painted two colors, so presumably the interior of each region is either black or white. And borders are black. Additionally, any point that lies exactly on a circle of integer radius is black (which could be part of borders). So the condition: if a point lies on a circle of integer radius (distance from origin is integer) -> black. If it lies on a border between two regions (presumably lines) -> black. Otherwise, its color depends on which region it falls, alternating.
But what are these regions? The picture likely shows a pattern like a dartboard: concentric rings of alternating colors? But then the phrase "between which and the origin of coordinates the distance is integral-value are painted black" suggests that the borders between rings (at integer radii) are black lines. So rings are possibly white and black? But they said painted two colors, so maybe it's alternating rings? But then why mention borders? Possibly it's more complicated: maybe the plane is partitioned by both circles and lines (like a polar grid). The phrase "border of one of the areas" likely refers to the boundaries that separate the areas (rings and sectors). If we have circles at integer radii, they divide the plane into concentric rings. Also maybe there are radial lines at angles that are multiples of something (like every 30 degrees? Not sure). However, the problem description doesn't mention angles. Only the distance integral-value condition. Possibly the areas are squares: The picture could be a chessboard pattern aligned with axes? But then what about distance integral condition? Could be that the clock is like a grid of squares with side length 1, centered at origin? And the border of squares (grid lines) are considered black. And additionally, any point whose distance from origin is an integer (i.e., lies on a circle centered at origin with integer radius) is black. That's plausible: The clock is tiled with black and white squares of size 1? But then there is also a condition about distance. Why would they add that? That seems like an extra pattern overlaying the squares.
But maybe the clock is painted in a checkered pattern on the plane: The picture might show a series of black and white regions arranged like a chessboard but with a twist: the center is a circle? Hmm.
Let's recall known problem: There is Codeforces Round #... problem "A. Magic Clock" maybe? I think I've seen a problem "Magic Clock" on Codeforces: I recall a problem about a magic clock where the plane is colored in a chessboard pattern based on the floor of the absolute coordinates? But I'm not sure.
Better approach: Let's search memory: In Codeforces problem set, there is "118D - Caesar's Legions" not. "Magic Clock" perhaps is problem 630J? No.
Actually, there is an open source problem from e-olymp: "Magic Clock" maybe number 744? I can try to search mental memory: There is a known problem: given point (x, y), output its color in an infinite checkerboard pattern where the square containing the origin is black? But then they also have the condition about integral distance from origin. That might be a trick: The color is determined by something like: if floor(x) and floor(y) parity? But then if the distance sqrt(x^2+y^2) is integer, override to black.
But the problem statement: "All the points located on the border of one of the areas have to be considered painted black." That implies that if a point lies exactly on a border between two areas (i.e., if any coordinate is integer? Maybe because the areas are squares of side length 1), then it is black. So maybe the areas are unit squares with sides parallel to axes, with alternating colors like a chessboard. The borders (lines at integer x or integer y) are black. Also "All the points between which and the origin of coordinates the distance is integral-value are painted black." That means points with integer distance from origin (i.e., on circles centered at origin with integer radius) are black. So these circles cut across the squares, and any point lying exactly on such a circle is black, regardless of the square color. So the color of a point is determined as: if it's exactly on any border (grid line) or on any integer-distance circle, output black; otherwise, if it's inside a square, output the color of that square (which alternates).
But is that what the picture shows? Possibly the clock has a pattern of black and white like a chessboard, but with additional black circles at integer radii. That could look like a clock face with radial markers? The picture might show the central part with concentric circles and grid lines forming a checkerboard pattern inside each ring? Not sure.
But the problem examples: Input: -2 1 => white. Input: 2 1 => black. Input: 4 3 => black.
Let's test our hypothesis: Suppose we have a checkerboard pattern: The origin (0,0) might be considered black? Usually in such problems, the cell containing the origin is black. However, we need to determine borders: The lines where x or y are integers are borders, so points exactly on integer coordinates are black. Also points with integer distance sqrt(x^2+y^2) are black.
Now test:
Case1: (-2,1). x=-2, y=1. Check if on border: is x integer? Yes -2 is integer. y=1 is integer. So this point is at integer coordinates; thus it's on a grid line intersection? Actually, point (-2,1) lies at coordinates that are both integers, so it's a grid point. That's definitely on a border (a corner). So according to rule, it should be black. But example output says white. So that contradicts.
Maybe the borders are not grid lines. Perhaps the borders are only the circles? But they said "border of one of the areas", which likely refers to the boundaries separating the two-color regions. So maybe the pattern is not a square grid. So point (-2,1) is not on a border, so its color is determined by something else, and it's white. In the example (2,1) is black. So (2,1) and (-2,1) have different colors. That suggests the pattern is not symmetric with respect to sign of x? But if the pattern is based on something like parity of floor of distance or angle? Let's see: (2,1) and (-2,1): they are symmetric about y-axis. Could the pattern be not symmetric? Possibly because the origin is at center, and the coloring might be defined by something like: the region between circles of radii n and n+1 is divided into 8n+4 sectors? That seems too complex.
Perhaps the pattern is like: The plane is divided into alternating black and white "cells" shaped like rings? But then why would (-2,1) and (2,1) be different? They are symmetric, so would be same color if pattern is symmetric about y-axis. Unless the pattern also depends on angle in a way that the coloring alternates per sector, but that would also be symmetric if sectors are defined starting from some axis? Maybe sectors are defined with respect to the positive x-axis? That could give difference: (-2,1) has angle about 153.43 degrees, while (2,1) has angle about 26.57 degrees. So if sectors are defined with reference to positive x-axis, the colors could be different if the number of sectors within a certain ring is odd? Let's explore.
The description: "The magic clock can be represented as an infinite Cartesian plane, where the origin corresponds to the clock center. The clock was painted two colors as is shown in the picture: The picture shows only the central part of the clock. This coloring naturally extends to infinity." Probably the picture looks like a target with alternating black and white concentric rings, and also radial lines dividing each ring into equal parts, maybe like a dartboard? But typical dartboard has alternating colors in sectors, not rings. Hmm.
Alternatively, maybe it's like a chessboard but rotated 45 degrees? That could cause asymmetry? Not sure.
Let's search internet memory: I recall a problem named "Magic Clock" from an old contest (perhaps from the Ural region). The solution involves checking if the point lies on a circle of integer radius or on a line at 45 degrees? Or maybe it's about determining the color in a pattern that is like a checkerboard but with the condition that points with integer radius are black. But example says (-2,1) white, but (2,1) black. If it's a standard checkerboard with origin black, and we define the color of a point not on border by the parity of floor(x)+floor(y). Let's compute for (-2,1): floor(-2) = -2, floor(1)=1, sum = -1, odd? -1 mod2 = -1 which is equivalent to 1 mod2? Actually parity: we need to define. Typically, for integer lattice, the cell with coordinates (i,j) where i and j are integers representing bottom-left corner, the color is black if (i+j) mod2 = 0 (assuming origin cell black). But point (-2,1) is at a corner; it's on border, so we ignore interior. But if we treat it as interior of a cell, we need to know which cell it belongs to. For points not on borders, we can take integer parts: floor(x) for x not integer, similarly for y. For point (-2,1), both are integers, so it's on a vertex, so it's border. So according to rule that borders are black, it would be black. But example says white. So maybe they treat integer coordinates as not borders? But they said: "All the points located on the border of one of the areas have to be considered painted black." That would include points on lines separating areas. For a checkerboard, the border lines are at integer coordinates? Possibly not: The areas could be defined differently, not squares.
Maybe the areas are the rings between consecutive integer-radius circles. Then borders are the circles themselves. Then any point with integer distance is on border, so black. Also maybe there are radial lines dividing each ring into equal angular segments. For example, maybe each ring of radius between n and n+1 is divided into 8n+4 segments? That seems plausible for a "clock" pattern: like a clock face with hour marks. But the picture might show something like: the clock is divided into 12 sectors (like hours) and concentric rings. But the problem says "painted two colors", so maybe it's like a checkerboard pattern on a polar grid: rings and sectors, alternating colors. Then the borders are the radial lines and circles. And points on those borders are black. Also, any point with integer distance from origin (i.e., on the circles) is black. That's consistent because circles are borders anyway. But they specifically mention that as an extra condition: "All the points between which and the origin of coordinates the distance is integral-value are painted black." Perhaps to emphasize that these circles are black even if they are not borders? But they are borders.
Now, example: (-2,1) vs (2,1). Compute distance: sqrt(4+1)=sqrt5≈2.236, not integer. So not on a circle. Are they on a radial line? Possibly radial lines at angles that are multiples of something like 30 degrees? Let's compute angle: for (2,1), angle = arctan(1/2) ~ 26.565°, not a multiple of 30. So not on typical radial line. So both points are interior of some region. Then their colors should be determined by the region's color. And they differ: one white, one black. So the regions are not symmetric about the y-axis? But the pattern might be defined with a reference axis; maybe the sectors are defined based on the positive x-axis as 0°, and the coloring alternates per sector, but then (-2,1) and (2,1) are in different sectors if the sectors are symmetric about the x-axis? Actually, (2,1) is in first quadrant, (-2,1) is in second quadrant. If the sectors are defined by lines at angles that are multiples of, say, 45°, then the first and second quadrants might have different color patterns. But (2,1) and (-2,1) are symmetric across y-axis; if the sector boundaries are symmetric about y-axis, then both points could be in corresponding symmetric sectors, which would have the same color if the coloring is symmetric about y-axis. But if the pattern is defined starting from the positive x-axis, then the sectors are not symmetric about the y-axis; the color might depend on the angle measured from positive x-axis, and since 180° - angle (for (-2,1)) is different, the color could differ if the number of sectors per ring is odd? But typical sector division: If we divide each ring into k sectors of equal angular width, then the color alternates per sector. If k is even, then symmetric points across the origin or axes might have same color? Actually, consider a ring divided into 12 sectors (30° each). Starting with sector from 0° to 30° colored black, then next white, etc. Then the sector containing (2,1) (angle ~26.5°) is in first sector (black). The point (-2,1) angle ~153.43° falls in the sector from 150° to 180°, which is the 6th sector if we start counting from 0°. If we alternate, sectors: 0-30 black, 30-60 white, 60-90 black, 90-120 white, 120-150 black, 150-180 white? Wait alternating starting black. So then (2,1) black, (-2,1) white. That matches the example: (2,1) black, (-2,1) white. So indeed if we have 12 sectors (or 8, or any even number) and start coloring appropriately, it's possible. But we also need to consider the rings: The color might also alternate in radial direction. In a polar checkerboard, we often have cells defined by rings and sectors, colored alternately in both radial and angular direction, like a chessboard on a polar grid. For example, for each integer radius n (n>=0), the region between circle radius n and n+1 is a ring. That ring is divided into maybe 8n+4 sectors? Or maybe the number of sectors per ring is constant? The problem statement doesn't specify. But the picture might show something: In many "magic clock" images, there are concentric circles and radial lines emanating from the center, creating a pattern like a spider web. Usually, each ring is divided into a number of segments that increase with radius, like each ring has more segments. But the picture might be static; maybe it's like a dartboard with 20 segments? Actually, typical dartboard has 20 sectors (angular divisions). But the problem says the coloring naturally extends to infinity. That means the pattern is not just a fixed number of sectors, because as radius increases, the number of segments would need to increase to keep the area of each cell roughly constant? Or maybe the pattern is based on integer lattice coordinates after mapping?
But the example (4,3) output black. Compute distance sqrt(16+9)=5, which is integer, so it's on a circle radius 5, so black. That matches: (4,3) distance 5 integer => black. So that's consistent with the integer-distance rule. So that example is simply explained by that rule.
Now for (2,1) and (-2,1), distance not integer. So the difference must be due to the underlying two-color pattern. So what pattern could yield (2,1) black and (-2,1) white? Possibly the pattern is not symmetric about the y-axis, i.e., it's oriented, maybe based on the sign of x or something. Another idea: The pattern could be based on the integer lattice but with the origin's square colored black, and the coloring of cells is determined by (floor(x) + floor(y)) % 2, but we need to handle points on borders specially. But we saw that leads to (-2,1) being a border point (since both coordinates integers), so black, which contradicts. But maybe they consider borders only as lines where x or y are integers and also not the intersection points? Or maybe the definition of areas is different: The areas might be defined by the circles and radial lines, not by grid lines.
Could it be that the areas are the squares of a chessboard but with the origin at the center of a square, not at a corner? In many problems, the plane is divided into unit squares with vertices at integer coordinates, and each square is colored based on the parity of (floor(x) + floor(y)) for points inside. But then the borders (the lines x = integer or y = integer) are considered black. In that case, a point exactly at integer coordinates is on a border, so black. So (-2,1) would be black. But the example says white, so this can't be.
Maybe the border considered black only applies to the circles? But they said "All the points located on the border of one of the areas have to be considered painted black." If the areas are the squares, then borders are lines at integer coordinates, but they'd be black. So again conflict.
Thus, it's unlikely that the areas are axis-aligned squares.
Perhaps the areas are the regions between the circles (rings) and between the lines that are at angles that are multiples of 45 degrees? Let's test: If we have circles at integer radii, and radial lines at angles that are multiples of 45° (i.e., lines y=0, x=0, y=x, y=-x, etc.), then the plane is divided into "cells" that are annular sectors. The borders would be the circles and these radial lines. Points on them are black. Now consider (2,1). (2,1) is not on any circle (distance sqrt5). Check if it lies on a radial line: the line from origin through (2,1) has slope 0.5, not 0, infinite, 1, or -1. So not on a radial line at 45°, 90°, etc. So (2,1) is inside a cell. Similarly (-2,1) is inside a cell. The cells are defined by angle intervals. If we have 8 sectors (by lines at 0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°), then the sectors are: 0-45, 45-90, 90-135, 135-180, etc. (2,1) angle ~26.6°, which lies in sector 0-45. (-2,1) angle ~153.4°, which lies in sector 135-180. If we color these sectors alternately with two colors, starting with maybe black for sector 0-45, then white for 45-90, black for 90-135, white for 135-180, etc. Then (2,1) would be black, (-2,1) white. That matches! And also radial lines and circles are borders, so black. So this pattern fits the examples? But what about the radial lines themselves? They are borders, so points on them are black. And circles are black.
Now need to consider the ring aspect: In such a division, the rings also alternate colors? Actually, if we only divide by angles into 8 sectors and do not consider radial divisions (i.e., no rings), then the whole plane would be just 8 infinite wedges. But then there is no reason to have circles as borders; the circles would be additional borders that cut across these wedges, creating more areas. The problem says the clock is painted two colors as shown in the picture, and the picture probably shows a pattern of alternating black and white regions in a radial grid: like a spiderweb or a dartboard with both radial and circular divisions. Typically, such a pattern has both circles and radial lines, and the regions (cells) are the intersections of rings (between consecutive circles) and angular sectors. And the coloring is like a checkerboard: each cell is either black or white, alternating both in radial and angular direction. For such a pattern to be consistent, the number of angular divisions might be constant, say 12 or 8, and the rings are between integer radii. Then the pattern alternates: the cell at ring i (between radius i and i+1) and sector j (some angular interval) will be black if (i + j) mod 2 = 0 (or some parity). Additionally, the borders (circles and radial lines) are black.
Now check our examples: (2,1) distance ~2.236, so it lies in the ring between radius 2 and 3? Actually integer radii: circles at r=0,1,2,3,... The point with distance 2.236 lies between 2 and 3. So ring index maybe floor(distance) = 2? Or maybe the ring between r=2 and r=3. Usually rings are defined as intervals [n, n+1) for integer n. So the ring number n (starting from 0) is where n <= r < n+1. For (2,1), r≈2.236, so n=2 (the third ring if counting from 0). For (-2,1), same distance, so same ring. So both are in same radial band. Their angular sectors: if we have, say, 8 sectors (45° each) with boundaries at 0°,45°,90°,135°,180°,225°,270°,315°, then the sector index can be floor(angle/45°) mod 8. For (2,1), angle=atan2(1,2) in degrees about 26.565°, floor(26.565/45)=0, sector index 0. For (-2,1), angle=atan2(1,-2) about 180-26.565=153.435°, floor(153.435/45)=3 (since 135 to 180). So sector index 3. If we color cells with parity (ring index + sector index) mod 2 = 0 -> black, then (2,1): ring=2, sector=0 => (2+0)=2 even -> black. (-2,1): ring=2, sector=3 => (2+3)=5 odd -> white. That matches! Also (4,3): distance=5 exactly, so on circle => black regardless. So this pattern fits all examples.
Now we need to confirm if this pattern is plausible given the description. The description says: "All the points between which and the origin of coordinates the distance is integral-value are painted black." That's the circles. "All the points located on the border of one of the areas have to be considered painted black." That's the radial lines (and circles, but circles already covered). The areas are the cells formed by circles and radial lines. So the borders are the circles and radial lines. Then the interior of each cell is painted either black or white in a checkerboard fashion. How many radial lines? The picture would show some number. Possibly 8 radial lines (at 0°,45°,90°,135°,180°,225°,270°,315°). But maybe there are 12? Let's think: The picture likely shows a central part of the clock. Clocks typically have 12 hour markings, so perhaps there are 12 radial lines (every 30°). Or maybe 8 lines (like a compass rose). Which one fits the given examples? In our test with 8 sectors (45° each), we got the desired outcome. But would 12 sectors (30° each) also give the same? Let's test: 12 sectors: boundaries at 0°,30°,60°,90°,120°,150°,180°,210°,240°,270°,300°,330°. For (2,1), angle≈26.565°, floor(26.565/30)=0, sector index 0. For (-2,1), angle≈153.435°, floor(153.435/30)=5 (since 150 to 180). Sector index 5. Ring index 2. Parity (2+0)=2 even -> black; (2+5)=7 odd -> white. So also matches. For any even number of sectors, as long as the starting offset is such that sector indices start at 0 for angle 0, and parity alternates, (2,0) even and (2,5) odd. So both 8 and 12 and any even number could work. But we need to determine the actual number of sectors.
We need to deduce from typical clock representation: A magic clock probably has hour marks. Usually a clock has 12 numbers, so 12 radial lines. But the picture is not visible; we can only infer from the problem that it must be consistent with the examples. Both 8 and 12 yield correct for these three examples. Could there be a difference for other points? Possibly the number of sectors is important for other points. The problem only gives three examples; they are not enough to uniquely determine. However, likely the pattern is based on dividing the plane into 12 sectors (like a clock face) because it's a clock. Also, the phrase "magic clock" suggests it's like a clock. And the picture likely shows a clock face with numbers and concentric circles? Actually, the picture might be something like: There are concentric circles at integer distances, and radial lines at angles that are multiples of 30 degrees (since a clock has 12 hour markers). That seems plausible.
But does it say anywhere that there are radial lines? The problem statement only mentions: "All the points located on the border of one of the areas have to be considered painted black." and "All the points between which and the origin of coordinates the distance is integral-value are painted black." It doesn't explicitly mention radial lines. However, the picture likely shows radial lines. So we must assume the pattern is formed by circles at integer radii and lines from the center at certain angles. The number of such lines must be even, to have two colors alternating. It could be 8, 12, 16, etc. But which one? Let's see if any other constraints: "The picture shows only the central part of the clock. This coloring naturally extends to infinity." In the central part, you might see a certain number of "spokes". If it's a clock, likely 12 spokes. Also many problems on Codeforces or e-olymp with "Magic Clock" use 12 sectors. I think I recall a problem named "Magic Clock" where the solution is to check if the point lies on a circle of integer radius or if the angle and distance produce a certain parity. I'm trying to recall memory: There is a problem from acmp.ru (Russian) "Magic Clock" maybe. I can search my memory: I think I've seen a solution: the color is white if floor(r) % 2 == 0 and sector parity, etc. But let's try to reconstruct.
We need to determine the exact rule from typical problems. Let's assume it's a polar grid: circles at integer radii (r = 0,1,2,3,...) and rays from the center at angles that are multiples of 30° (i.e., π/6). Then the plane is divided into cells: each cell is defined by integer radius interval [n, n+1) and angle interval [k*π/6, (k+1)*π/6) for integer k=0..11 (or more as it extends to all integers? Actually, the rays extend in both directions, so there are 12 sectors per full circle). Then the cells are colored alternately like a chessboard: adjacent cells (sharing a border) have different colors. The natural way: assign black to the cell containing the origin? But the origin is a point; maybe the central circle r=0 is a point, but it's a border? Actually, the origin is the center, which is on all rays? Not exactly: the rays emanate from the origin, so the origin is on all borders. So it's considered black (as per border rule). So we don't need to assign interior color to origin. For the first ring (0 < r < 1), there are 12 sectors. They must be colored alternately. So if we set sector 0 (angle from 0 to 30 degrees) black, then sector 1 white, sector 2 black, ... etc. Or vice versa. Similarly, the next ring (1 < r < 2) would have the opposite color for sector 0 compared to the same sector in the previous ring? Because adjacent rings share a circular border, so cells on opposite sides of the circle should have different colors. So the color should alternate with radius as well. So a typical assignment: color = (ring_index + sector_index) % 2 == 0 ? black : white, where ring_index = floor(r) (maybe with special handling at integer r). But since points on integer r are borders, they are black regardless. Also points on rays (angles exactly multiple of 30°) are borders, also black. So for interior points (not on borders), we can compute parity.
Now, does this match the examples? For (2,1): r = sqrt(5) ≈2.236, floor(r) = 2. Compute angle: atan2(y,x) in radians or degrees. For (2,1), angle ~ 26.565°, sector_index = floor(angle / 30) = 0 if we use 30° sectors. (Assuming sector 0 from 0 to 30). Then (2+0) even => black. For (-2,1): angle = 180-26.565=153.435°, floor(153.435/30)=5 (since 150-180). 2+5=7 odd => white. Good.
For (4,3): r=5 exactly => border => black.
Thus, the pattern with 12 sectors works.
Now, could it be 4 sectors? Let's test 4 sectors (90° each). Then sector for (2,1): angle 26°, floor(26/90)=0 => sector 0. (-2,1): angle 153°, floor(153/90)=1 => sector 1. (2+0) even black, (2+1)=3 odd white -> also matches. So 4 sectors also works? But 4 sectors would mean radial lines at 0°, 90°, 180°, 270°. That would give only 4 sectors. But would the picture look like a clock? Probably not. Also, the border lines are only at those angles; but the example (2,1) and (-2,1) are not on those lines, so interior. 4 sectors could produce the same parity differences if the parity assignment is as described. But is it consistent with typical coloring? If we have only 4 sectors, the pattern would be coarse. The picture likely shows more divisions.
Moreover, many problems like this have 12 sectors because it's a clock. I recall a problem "Magic Clock" from acmp.ru (maybe problem 291). I could try to recall: I've seen a solution: "if (int(sqrt(xx+yy))%2==0 && (atan2(y,x) ... )" Actually, I'm not certain.
Let's search memory: There is a Codeforces problem "630K Indivisibility" no. Another: "Magic Clock" on e-olymp #744? I think there is a problem from "Ural Regional School Programming Contest" maybe. Let's think: The problem ID could be 1593? Not sure.
Maybe I can find a known pattern: There is a problem "CF 630C Lucky Numbers"? Not.
Alternatively, maybe the radial lines are at angles that are multiples of 45°, because that yields a pattern that aligns with the axes and diagonals, which is common in coordinate geometry problems. But a clock typically has 12, not 8. However, the picture might show a clock with numbers 1-12, so 12 sectors.
But does the problem statement mention anything about the number of areas? Possibly the picture shows a central part with many cells; perhaps there are 8 sectors? Without the picture, we must infer from typical expectations.
We could also consider the phrase "All the points between which and the origin of coordinates the distance is integral-value are painted black." This is reminiscent of the "magic circles" of a clock. And "All the points located on the border of one of the areas have to be considered painted black." This could refer to the hour markers as borders.
Let's assume 12 sectors. But we need to be absolutely sure, because the solution might need to work for all points with |x|,|y| <= 1000. So we need to implement a rule that matches the judge's expectation. How can we deduce the exact pattern? Possibly from the fact that it's a "clock", the natural division is into 12 equal sectors (like hours). Also many contest problems use 12. Also, I've seen a problem "Magic Clock" on Timus? Actually, Timus has problem 1493 "One Step from Happiness" not. There is "Magic Clock" on acmp.ru maybe. Let's quickly search memory: I think I have solved a problem called "Magic Clock" on e-olymp: the solution was to output "black" if the integer part of the distance plus the integer part of the angle/(30 degrees) is even, else "white", except when the distance is integer. That seems plausible.
Alternatively, could it be that the number of sectors is 8? Because 8 is easier to compute with angles of 45°, and one can determine sector based on comparisons of absolute values? For example, you can determine which octant by comparing |x| and |y| and signs. But with 12 sectors, it's a bit more work: need to compute atan2 and divide by 30°, but still doable. However, maybe they want to avoid floating point precision issues? But they say coordinates are integers up to 1000, so r sqrt can be computed as double, but we need to compare exactness for integer distance. We can compute squared distance, check if it's perfect square. For angle, we could avoid floating point by using cross and dot products to determine which sector (like using integer arithmetic with slopes). But 12 sectors would require comparing angles to tan of 15°, 30°, etc., which can be done by comparing y * cos(angle) with x * sin(angle) etc. Might be messy but doable.
But maybe the intended solution is simpler: They might be using the concept of "rings" and "sectors" where the number of sectors is equal to 4 (i.e., quadrants) or 8 (octants) because those align with integer coordinates? However, the example (2,1) and (-2,1) both have same quadrant? Actually, (2,1) is first quadrant, (-2,1) is second quadrant. In a quadrant-based pattern (4 sectors), they would be in different quadrants. If we color quadrants alternately: e.g., Q1 black, Q2 white, Q3 black, Q4 white, then (2,1) black, (-2,1) white. That matches! Additionally, we also have rings: maybe each quadrant is further subdivided by circles, and color alternates per ring. But in that pattern, the ring parity plus quadrant parity could produce the same effect. For (2,1): distance ~2.236, ring=2, Q1 index 0 (if Q1 index=0), (2+0) even -> black. For (-2,1): Q2 index=1, (2+1) odd -> white. So quadrant pattern alone (without further angular subdivisions) would give same result for these points. But would that be consistent with the picture? The picture likely shows more than 4 sectors. But maybe it's 4? The picture could be a simple target with concentric circles and the axes dividing into 4 quadrants. But then there would be only 4 "areas" per ring? But the picture probably shows many more because the statement says "The picture shows only the central part of the clock. This coloring naturally extends to infinity." The central part would show several rings and maybe 4 spokes (axes). That would be plausible: like a dartboard with concentric circles and the axes dividing it into 4 quadrants, and the quadrants are colored alternately, and rings also alternate, giving a checkerboard pattern in polar coordinates. That is simple: there are only 4 sectors (the quadrants). The borders are the axes (x=0, y=0) and the circles at integer radii. Points on axes or circles are black. Then interior points: color determined by parity of (floor(r) + quadrant_index) mod 2. That fits the examples. And it's easy to compute: quadrant index can be 0,1,2,3 based on signs of x and y. But careful: Points on axes are borders, so they are black. That includes points where x=0 or y=0. So any point with x=0 or y=0 is black. That is consistent with "border".
But does that match the picture? Possibly the picture shows a clock with numbers, which suggests 12, but a clock face usually has 12 numbers, but the picture might be more like a stylized magic clock with 4 main divisions? Without the picture, it's ambiguous.
Let's examine sample more deeply: The examples given: (-2,1) white, (2,1) black, (4,3) black. In the quadrant model, (4,3) distance 5 integer => black. That's fine. But also what about a point like (1,0)? x>0,y=0 -> on border (axis) => black. Does that make sense? Possibly. But we don't have an example.
But could there be a point like (1,1) distance sqrt2 not integer, and in Q1. ring floor(sqrt2)=1. Q1 index say 0. 1+0=1 odd => white? Or maybe black? Without a sample, we don't know.
We need to be sure. Let's see if any other known problem "Magic Clock" exists. I can search mental database: On Codeforces, there is problem "630A - Again Twenty Five!" no. On e-olymp, I recall problem "746 - Magic Clock". Actually, I'm going to think: I've seen a problem named "Magic Clock" that asks to determine color given coordinates, with circles at integer distances and radial lines at angles that are multiples of 30°, and solution: if distance is integer: black; else if floor(distance) mod 2 == sector mod 2: black else white. That sounds familiar. Perhaps I saw it on a Russian site like acmp.ru (acm.timus.ru maybe). The problem ID might be 1025 or something.
Let's try to google in my mind: "Magic Clock" + "All the points between which and the origin of coordinates the distance is integral-value are painted black." I recall that phrase "All the points between which and the origin of coordinates the distance is integral-value are painted black." That is a direct quote. I think I've seen this problem before. It might be from the Ural Championship or from the school contest. I think it's problem 1084 on Timus? Actually, Timus 1084 is "Goat in the Garden". Not. Another: Timus 1490? Not.
Wait, I recall a problem: "Magic Clock" from the contest "2009-2010 ACM-ICPC, NEERC, Northern Subregional Contest" or something? Not sure.
Maybe I can find by recalling solution code. I've seen a solution where they compute d = floor(sqrt(xx+yy)) and then compute angle sector by comparing y and x ratios. They use something like: if x==0 or y==0 -> black. Else determine which of the 12 sectors by comparing |y| and tan(15°)*|x|, etc. That seems plausible.
But also, I recall a simpler problem: "CF 60A - Where Are My Flakes?" no.
Let's try to derive from typical contest constraints: Coordinates up to 1000, so distance up to ~1414. They want to avoid floating point errors? Possibly they want to use integer arithmetic. The check for integer distance is easy: check if x^2+y^2 is perfect square. For the angle sector, if there are 4 quadrants, it's trivial. If there are 8 or 12, it's a bit more but still doable with integer comparisons using cross products to avoid floating point. For 12 sectors, you'd need to compare slopes to tan(15°), tan(30°), tan(45°), etc. But these are irrational, but you could compare by squaring or using rational approximations? However, the coordinates are integers, so you could determine the angle quadrant and then compare y/x with tan(15°) = 2-√3? Not nice. But you could precompute tan values as double and compare, but that might cause precision issues at boundaries? But boundaries are borders (lines at multiples of 30°), and points on borders are considered black. So if a point lies exactly on a border, we must output black. For integer coordinates, the only points that lie exactly on lines at multiples of 30° are those where the line goes through integer lattice points. For example, line at 30°: slope = tan30 = 1/√3 ≈0.57735; integer points on that line are like (1,0?) Not many. For a point to be exactly on such a line, it must satisfy y = x * tan(angle). Since tan(30) = 1/√3, irrational, only (0,0) works. So for integer coordinates not zero, they won't lie exactly on those radial lines except the axes (0° and 90°, etc.) or maybe 45° line (slope 1) which has many integer points. So for 12 sectors, the only radial borders that could be hit by integer points are the axes (x=0, y=0) and the lines at 45°? Actually 45° is not a multiple of 30? 45 is not multiple of 30. So if sectors are multiples of 30°, the borders are at 0°,30°,60°,90°, etc. The only ones with rational slopes are 0°, 90°, maybe 45° is not included. So only axes are rational. So integer points will almost never lie exactly on other radial borders. So we don't need to worry about precision for detecting border except axes. But the border condition for circles: integer distances can be checked exactly. So for interior points, we can compute sector using floating point (atan2) and then floor division by 30°, but we need to ensure that if due to floating error we misclassify a point that is extremely close to a border (but since integer coordinates, it's not exactly on border, so a small error won't change the integer sector index, as long as we treat the boundaries correctly). But we need to be careful: For a point like (1,0) angle 0°, it's on border (axis). That's black. But if we compute atan2(0,1)=0, then floor(0/30)=0. That would assign it to sector 0, but we need to output black because it's on border. So we must explicitly check if point lies on any border: either distance^2 is perfect square, or x==0 or y==0 (since those are radial lines). Actually, for 12 sectors, the borders are at angles 0°,30°,60°,90°, etc. So points on y=0 (positive x axis) are border; also on x=0 (positive y axis?) Actually, x=0 corresponds to angle 90° or 270°, which are borders. So yes, axes are borders. Also points on line at 30°, e.g., where y/x = tan30, but integer points won't satisfy exactly, so we can ignore. So the only radial borders that matter for integer points are axes. So the condition for radial borders reduces to x==0 or y==0.
But the problem says "All the points located on the border of one of the areas have to be considered painted black." That includes not only axes but also lines at 30°, 60°, etc. But if integer points never lie on those lines, we can ignore them for classification. However, we must handle the case if a point lies exactly on such a line (e.g., (0,0) obviously on all). But coordinates are integers up to 1000, so only (0,0) is on many lines; also points like (1,1) are on line at 45°, but if 45° is not a border (if sectors are 30°), then it's not border. So if sectors are 12, 45° is not a border. So (1,1) is interior. So fine.
Thus, the implementation for 12 sectors would need to compute which sector a point is in, based on angle ranges. Could do with atan2 and division by 30°, and then floor. Or could compute using cross product with known vectors along borders.
But maybe the intended number of sectors is 4, because then it's much simpler: just quadrant and parity of floor distance. That would be a very easy problem, appropriate for simple contest. But then why mention "All the points between which and the origin of coordinates the distance is integral-value are painted black"? That would already be included as border. And the picture could be just concentric rings and axes. That seems plausible. However, the phrase "magic clock" suggests something like a clock with numbers, but a clock typically has 12 numbers. But a "magic clock" might be a fantasy thing.
Let's check the examples again: (-2,1) white, (2,1) black. In quadrant model with rings: floor(r)=2, quadrant of (2,1) is Q1 (say index 0), quadrant of (-2,1) is Q2 (index 1). If we assign Q1 even? Need to decide parity mapping. Typically we could set (floor(r) + quadrant) %2 == 0 -> black. That yields (2+0)=2 even-> black, (2+1)=3 odd-> white. Good. So it's consistent.
Now consider another point to test: (1,1). r = sqrt2 ~1.414, floor=1, Q1 index 0, sum=1 odd -> white. But is there any example or known expectation? Not given. If we had 12 sectors, what would (1,1) be? Angle 45°, which if sectors are 30° each, 45° lies in sector index 1 (30-60). Then floor(r)=1, sum=1+1=2 even -> black. So the predictions differ! For (1,1), quadrant model says white, 12-sector model says black. So we can determine which model is correct if we can find expected answer from known problem or by reasoning.
I recall that I might have seen a solution for this problem before, and it involved dividing into 12 sectors. Actually, I'm leaning toward 12 sectors because the problem name "Magic Clock" suggests hour markings. And many solutions online use 12 sectors. Let me search memory: I think I recall a problem "Magic Clock" from Codeforces gym or something. Actually, there is a problem on Codeforces: "630A - Again Twenty Five!" is not. I'm going to think: There is a problem on e-olymp: "744 - Magic Clock". I think I have solved it before. The solution in C++ might look like:
if (x == 0 || y == 0 || isSquare(xx + yy)) cout << "black";
else {
int d = (int)sqrt(xx + yy);
int sector;
// determine sector among 12
// using atan2 and dividing by PI/6
// then if ((d + sector) % 2 == 0) black else white
}
I'm not sure.
Let's attempt to recall from known sources: On the website acmp.ru (Russian), there is a problem "Часы" (Clock). But not sure.
Maybe I can search logic: In many problems about "magic clock" they refer to a picture that is often used: it's like a dartboard with alternating black and white sections, but with 12 sections. I've seen a problem from the Russian school contest "Magic Clock" (Volchansk). Hmm.
Another angle: The phrase "All the points between which and the origin of coordinates the distance is integral-value are painted black." This is a bit awkward English. Possibly it's translated from Russian. In Russian problems, they often have a picture of a clock with concentric circles and radial lines at 30°, and the circles are at integer distances. That is a common pattern: it's like a target with rings and sectors. The color alternates like a chessboard. And points on the circles and radial lines are black. That's exactly what we described.
Now, is there any other nuance? The problem says: "All the points between which and the origin of coordinates the distance is integral-value are painted black." That might be interpreted as: For any point, if the distance from that point to the origin is an integer, then that point is black. That's clear.
The other statement: "All the points located on the border of one of the areas have to be considered painted black." So points on borders are black. This covers the radial lines.
Thus, for interior points (not on integer distance circles and not on any radial line), we need to determine the color based on the region.
Now, what are these areas? They are the regions bounded by consecutive circles and consecutive radial lines. The picture likely indicates that the areas are colored in a checkerboard pattern, alternating black and white. So we need to determine the parity of the region.
How many radial lines? That determines the number of sectors. If we look at a clock, there are 12 hour marks, but are they all lines? Usually a clock face has 12 markings, but not necessarily lines from the center to the edge; they might be just ticks. But in a typical "magic clock" picture (I think I've seen it), there are 12 lines from the center to the edge (like a star). Actually, I recall a problem from Codeforces Round #...? I think there is a problem "Magic Clock" from Codeforces Beta Round #96 (Div. 2) maybe? Let's search memory: Codeforces Beta Round #96 had problem A "HQ9+" and B "...
I could quickly think: I've seen a problem "CF 173A - Clock" no.
Maybe I should search for "magic clock codeforces" in my mind: I recall a blog post about "Magic Clock" problem and its solution: determine color black or white. The solution used the distance and angle. They computed sector as (int)(atan2(y,x) / (PI/6) + 12) % 12. Then if on circle or on line (if sector fractional part close to 0?), they output black. But since integer coordinates rarely lie exactly on lines except axes, they just check xy==0. And for integer distance, they output black. Else they compute d = (int)sqrt(xx+y*y) and if ((d + sector) % 2 == 0) black else white.
Yes, I think I've seen that. I'm leaning that it's 12 sectors.
Let me try to verify with a test: (1,1) would be: distance sqrt2 ~1.414, not integer. x and y non-zero so not on axes. sector: atan2(1,1)=45°, divide by 30 => 1.5, floor? Usually sector index from 0 to 11: idx = floor(angle / 30) if angle in [0,360). But careful: 45° gives idx = 1 (since 30-60). So idx=1. floor(r)=1. (1+1)=2 even -> black. So (1,1) would be black.
What about (-1,1)? angle=135°, floor(135/30)=4 (120-150). floor(r)=1. (1+4)=5 odd -> white.
Now, is that plausible? Could be.
What about (2,2)? distance sqrt8≈2.828, floor=2, angle 45°, sector=1, sum=3 odd -> white? That would be white. But if we consider quadrant model: (2,2) floor=2, Q1 index 0, sum=2 even -> black. So they differ. Which one might be expected? Not given.
Consider (3,4): distance 5 integer -> black in both.
Consider (0,1): on axis -> black.
Consider (1,0): on axis -> black.
Consider (1,2): distance sqrt5≈2.236, floor=2, angle about 63.434°, sector: 63.434/30=2.114, floor=2 (sector 2: 60-90). sum=2+2=4 even -> black. In quadrant model: floor=2, Q1 index 0, sum=2 even -> black. So same.
Consider (2,3): distance sqrt13≈3.606, floor=3, angle about 56.31°, sector=1 (30-60) => 3+1=4 even black. Quadrant: floor=3, Q1 index 0 => 3 odd white. So they differ. So we could test with a point like (2,3). But we don't have sample.
Maybe we can infer from typical puzzles: The magic clock picture might have many sectors, likely more than 4, because 4 would be too simple and the picture would show only 4 "spokes". Usually a clock face has 12 hour markers, so 12 spokes. So I think it's 12.
Also, many solutions I've seen online for "Magic Clock" indeed use 12 sectors. Let's try to recall if I've ever coded this problem. I think I have; I recall using atan2 and dividing by M_PI/6. Yes, that rings a bell. There's a problem on e-olymp: 744 "Magic Clock". I've solved e-olymp problems before. Let me recall: e-olymp 744 is "Magic Clock"? I'm not sure. I can quickly simulate: I think there is a known problem "Magic Clock" where you need to output the color. I think I've seen a solution in Python that does something like:
import math
x,y=map(int,input().split())
d2=xx+yy
d=int(math.sqrt(d2))
if dd==d2:
print('black')
elif x==0 or y==0:
print('black')
else:
angle=math.atan2(y,x)
if angle<0: angle+=2math.pi
sector=int(angle// (math.pi/6))
if (d+sector)%2==0:
print('black')
else:
print('white')
Yes, that seems plausible.
But we also need to consider the border lines at angles that are multiples of 30 degrees. However, as argued, integer points won't lie exactly on them except axes. But what about points like (0,0)? That's origin, which is on all borders, black. So axes are covered by x==0 or y==0. But also lines at 30°, 60°, etc. Could a point with integer coordinates lie exactly on those lines? For 30°, slope = 1/√3, irrational, so only (0,0). For 60°, slope = √3, also irrational. So no integer points (except origin) lie on those lines. So we don't need to check them.
Thus, the only border checks needed are: (1) whether x==0 or y==0, (2) whether sqrt(x^2+y^2) is integer. If either, output black. Else compute d = floor(sqrt(x^2+y^2)) and sector = floor(angle / (π/6)) (0 to 11), and if (d + sector) % 2 == 0, output black else white.
But is the origin considered? (0,0) satisfies both x==0 and y==0, and distance 0 integer, so black.
Now, what about negative angles? We need to map angle from 0 to 2π. atan2 returns in (-π, π]. We can add 2π if negative to get [0, 2π). Then sector = floor(angle / (π/6)). That gives 0 for [0,30°) etc. But careful: The border lines are at angle 0,30,60,... 330 degrees. Points exactly on border (like angle 0) are black; but if x>0,y=0 gives angle 0, which is border, we already handle x==0 or y==0? Actually, y=0 is a border (the positive x-axis). So we catch with y==0. Similarly, x=0 is border. But what about angle exactly 30°? Could there be a point with integer coordinates exactly on that line? Possibly no. So fine.
Now, need to verify with sample: (-2,1): x=-2,y=1, not on axes, distance sqrt5 not integer. Compute angle: atan2(1,-2) = π - arctan(0.5) ~ 2.03444 rad (~116.565°). Actually, atan2(1,-2) returns approx 2.03444 rad, which is >0. But that's about 116.565°. In degrees: 180-26.565=153.435°? Wait, I need to recalc: For point (-2,1), x negative, y positive, angle in standard math: atan2(y,x) returns angle from positive x axis, positive counterclockwise. So atan2(1,-2) = π - atan(0.5) ≈ 3.1416 - 0.46365 = 2.67795 rad? That's approx 153.435°. Actually, π is 3.1416, minus 0.46365 = 2.67795 rad. Yes, 2.67795 rad = 153.435°. So angle = about 2.67795 rad. Now sector size = π/6 ≈ 0.5236 rad. Divide: 2.67795/0.5236 ≈ 5.114, floor = 5. So sector =5. d = floor(sqrt5)=2. (2+5)=7 odd -> white. Good.
(2,1): angle = atan2(1,2) ≈ 0.46365 rad (26.565°). /0.5236 ≈0.886, floor=0. d=2 -> sum=2 even -> black.
(4,3): distance sqrt(25)=5 integer -> black. Also not on axes.
Matches.
Now, we need to be careful about the case where the point is exactly on a circle: we output black. Also on axes: black. Also if the point is exactly at the origin: black.
Now, what about points exactly on radial lines that are not axes? As argued, integer points won't be, but if we use floating point we might misclassify due to rounding when angle is extremely close to a multiple of π/6. But since we explicitly check borders, we could also check if angle is exactly a multiple of π/6 within epsilon, but that would not happen for integer coordinates except maybe when x=0 or y=0 or maybe when point lies on line y = x * sqrt(3) etc., but since sqrt(3) irrational, no integer points. But what about point (0,0)? Already covered. So it's safe.
One nuance: For points exactly on a circle (distance integer) we output black. But also note that if a point is exactly on a circle, it's also a border between rings, so it's black. That's consistent.
Now, does this pattern with 12 sectors also satisfy "All the points between which and the origin of coordinates the distance is integral-value are painted black"? Yes.
Also "All the points located on the border of one of the areas have to be considered painted black." That includes the radial lines, which we treat via axes only? Actually, there are many radial lines: at 30°, 60°, etc. But as we said integer points won't be on them, but they could be rational points? The input coordinates are integers, so it's fine. For completeness, we could also check if angle is exactly multiple of 30°, but not necessary.
Now, verify that the assignment of parity (d + sector) % 2 is correct. How do we know that the color pattern is (d + sector) % 2 == 0 -> black? We need to determine the correct parity orientation. In the examples, (2,1) gave black, so (d+sector) even gave black. That is our assumption. Could it be the opposite? Possibly. Let's test with a point that is on the first ring (0<r<1) and sector 0. For such a point, we need to know its color. The picture likely shows the central circle (r<1) divided into 12 sectors. The origin is black (border). The immediate area around the origin: for small r>0 but not on border, what color? For r in (0,1), d=0? Wait floor(r) for r in (0,1) is 0. So d=0. For sector 0 (angle 0-30°), (0+0)=0 even -> black. So that region would be black. But is that consistent with the picture? Possibly the central area (first ring) might start with black? We can't be sure. But if the origin is black, it's a point, but the area immediately around might be white? The picture might show the central small circle as black? Actually, the central point is black, but the area around is something else. However, the picture is not provided, so we cannot verify. But we can rely on the examples: (2,1) black, (-2,1) white. That forced the parity for those specific (d, sector) combos. Since we only have those, we can adopt the parity that matches. So we can set condition: if (d + sector) % 2 == 0, then black; else white.
Now, we need to be careful about the indexing of sectors. We assumed sector 0 corresponds to angle [0,30°). Is that correct? It could also be that sector 0 starts at angle 15°? But the borders are at multiples of 30°, so sectors are between those lines. So sector 0 is between 0° and 30°. That's plausible. Also we need to decide the orientation: where is the 0-degree ray? Typically it's the positive x-axis. That seems standard.
Now, about negative angles: we map to [0,2π). So sector indices from 0 to 11.
Now, we also need to handle the case when r is exactly integer: we already output black, so we don't compute d and sector? But careful: For points exactly on circle, they are on border, so black regardless. But what about points exactly on radial lines that are not axes? They are also black, but they could also be on a circle? That's fine. For integer points, only axes are radial borders, so we already handle x==0 or y==0 as black.
But what about points exactly on both a circle and a radial line? Already black.
Now, we must also consider if a point is exactly on a circle but we might also compute d = floor(r) which would be equal to r (since r integer). But if we treat separately, we can just check if sqrt is integer first.
Now, we need to be careful about floating point precision when computing sqrt of integer up to 1000^2+1000^2=2,000,000, which is within 2e6, so sqrt up to ~1414. So double precision is fine. But checking if sqrt is integer: compute d2 = xx+yy, compute d = int(sqrt(d2)), then check if d*d == d2.
For angle, we can compute using math.atan2(y,x) which returns in radians. Then compute sector = int(angle / (math.pi/6)). But careful: For points with negative angle, we need to add 2π to get positive. So if angle < 0, angle += 2π. Then sector = int(angle / (math.pi/6)). Since angle will be in [0, 2π). However, when angle is exactly 2π (i.e., for point on positive x-axis? Actually angle=0 for positive x-axis, not 2π). atan2(0, positive) gives 0. So fine. For point on negative x-axis? atan2(0, negative) returns π (approx). So that's fine.
But for points on positive x-axis (y=0, x>0): angle = 0. Then sector = 0. But we will output black anyway because y==0. So it's fine. For negative x-axis (x<0, y=0): angle = π, sector = int(π / (π/6)) = int(6) = 6. But we output black because y==0. So not needed.
Now, is there any possibility that a point lies exactly on a border due to being on a circle and we would incorrectly compute d as floor(r) and then parity? We will have an early check for integer distance, so we skip parity.
Now, what about points with x=0 or y=0? Those are radial lines, so black. That matches the rule: border -> black.
Now, one more nuance: What about points that are exactly on the border between two sectors but not on axes? Since integer coordinates cannot be exactly on those lines, it's fine. However, due to floating point error, when computing angle for a point that is very close to a multiple of π/6, we might get a value slightly less or more, causing floor to give wrong sector. But again, since it's not exactly on border, the correct sector is whichever side it is on, and small errors won't matter if we compute accurately? For integer coordinates, the angle is not an exact multiple of π/6 (except axes). So we can safely compute.
But we might want to avoid floating point entirely by using a method based on vector cross product to determine which sector it belongs to among 12. But given constraints, double is fine.
Alternatively, we could compute sector using the slope and compare with tan values. But that's more work.
So the solution plan:
- Read integers x,y.
- Compute d2 = xx + yy.
- Compute d = integer sqrt (floor) via int(sqrt(d2)).
- If d*d == d2: print "black" and return.
- If x == 0 or y == 0: print "black" and return.
- Else compute angle = atan2(y, x). If angle < 0: angle += 2*pi.
- sector = int(angle / (pi/6)). But careful: angle / (pi/6) gives a floating number between 0 and 12 (exclusive 12). floor gives integer 0..11.
- if (d + sector) % 2 == 0: print "black" else print "white".
But we must ensure that for points with r < 1, d = 0. That is correct.
Now, confirm with some additional tests: (0,0): distance 0 integer -> black.
(1,0): x? y=0 -> black.
(0,1): x=0 -> black.
(1,1): not on axes, d2=2, sqrt not integer, d=1, angle=45° -> angle=0.785398 rad, / (π/6)=0.785398/0.523599=1.5, floor=1, sector=1, d+sector=2 even -> black. So output black.
( -1, -1): x,y both negative, not axes, d2=2, d=1, angle=atan2(-1,-1)= -135°? Actually atan2(-1,-1) = -3π/4 = -2.35619 rad, add 2π => 3.92699 rad (225°). sector = floor(225/30)= floor(7.5)=7. So sector=7, sum=1+7=8 even -> black. So black.
(2,3): earlier we predicted black for 12-sector? Let's compute: d2=13, d=3 (since 3^2=9<13<16), sqrt=3.606, floor=3. angle=atan2(3,2)=0.9828 rad = 56.31°, /30=1.877, floor=1, sector=1, sum=4 even -> black. So black.
(2,-3): angle negative, adjust: atan2(-3,2) = -0.9828 => +2π=5.300 rad (303.69°), /30=10.123, floor=10, sector=10, sum=3+10=13 odd -> white.
Now, without known answers, we can't verify.
Now, consider (0,2): y=0 -> black.
Consider (1, sqrt(3)? Not integer.
Alright.
Now, is there any possibility that the pattern uses a different starting parity? For example, maybe (d + sector) % 2 == 0 -> white? But our examples require (2,1) black and (-2,1) white. For (2,1), d=2, sector=0, sum even => black. For (-2,1), d=2, sector=5, sum odd => white. So parity even => black works. If we reversed, (2,1) would be white, contradicting example. So our parity assignment is fixed.
Now, confirm that we correctly compute sector for points on the boundaries between sectors? As argued, for integer coordinates, only axes are boundaries; we already catch those as black. So fine.
Now, about the border condition: "All the points located on the border of one of the areas have to be considered painted black." This includes also the circles at integer radius. So our early check for integer distance covers that. It also includes the radial lines. For radial lines, we only check x==0 or y==0 because other radial lines (at multiples of 30°) do not contain any integer points (except origin). However, what about points like (0,0)? Already covered.
But what about points like (2,2)? It lies on line y=x, which is at 45°, which is not a border if the sectors are at multiples of 30°. So it's interior. So we don't need to consider it as border. So our check is sufficient.
But wait: Could there be radial lines at angles that are multiples of 45°? That would be 8 sectors. If that were the case, then (1,1) would be on border and should be black. But our example (1,1) is not given, but we could test if (1,1) is black or white? The problem doesn't provide, but we can infer: If the picture shows a clock with 12 hour markers, the radial lines are at multiples of 30°, so 45° is not a border. If it were 8 sectors (45°), then (1,1) would be on border, so black. In our 12-sector model, (1,1) is interior and we computed black anyway. So both models give black for (1,1). So that doesn't differentiate.
What about (1,2) we already considered; both gave black. (2,3) gave black for 12-sector, white for quadrant model. So that is a point where they differ. If I could recall known answer for (2,3) from some source, I'd know. But I don't. Could we reason from the picture? Without picture, it's hard. But perhaps we can search memory: I think I've seen a discussion about this problem, and the solution involved dividing the circle into 12 parts. Let me try to recall more concretely. The problem statement on Codeforces (if it is from there) might have a picture. I can try to visualize typical "magic clock" pictures from such problems. Actually, I think there is a Codeforces problem "630A - Again Twenty Five!" no. Maybe it's from an old contest like "School Team Contest #1 (Winter Computer School 2010/11)"? I'm not sure.
I recall a problem named "Magic Clock" on a site called "acmp.ru" (acm.timus in English?) Actually, acmp.ru is a Russian site for school contests. I might have solved it there. Let me think: On acmp.ru, problem number 291 is "Magic Clock"? I'm not sure. I could quickly simulate a mental search: If I google (in mind) "acmp magic clock" I recall a problem ID maybe 1000? No.
Better: I can reason about the picture from the description: "The picture shows only the central part of the clock. This coloring naturally extends to infinity." If we imagine a clock face, it has numbers 1-12, and usually there are lines from the center to each number (or just marks). But a typical clock face does not have alternating colors in rings and sectors; it's usually a single color with markings. But a "magic clock" might have a pattern like a chessboard on a polar grid. The picture could be like a dartboard with alternating black and white sections, often used in puzzles. Actually, a dartboard has 20 sectors, not 12. But a clock has 12. So it's ambiguous.
But many problems use 12 because it's standard for a clock. I think it's safe to assume 12.
Moreover, I recall a known Codeforces problem: "CF 630A - Again Twenty Five!" is not. But there is a problem "CF 630B" etc. Not.
Wait, I recall a problem "Magic Clock" from the contest "2013-2014 ACM-ICPC, NEERC, Northern Subregional Contest" maybe? Not.
Let's search memory: There's a problem on Codeforces Gym called "Magic Clock" from the "2007-2008 ACM-ICPC, NEERC, Northern Subregional Contest". I'm not sure.
Actually, I think I remember a problem: "Ural Championship 2012: Problem B - Magic Clock". Not sure.
Given that the problem is relatively simple (only need to output black or white), many participants would implement with atan2 and mod 2, which is easy. The problem constraints are small, so it's fine.
But what about the possibility of 4 sectors? That would be even simpler: no need for trig; just compute quadrant based on sign of x and y. But then they'd have to treat axes as borders anyway. However, the picture likely shows more than 4 sectors. The phrase "magic clock" might imply 12 because of 12 hours. Also, the example (2,1) and (-2,1) can be explained with 4 sectors, but also with many others. But I recall many problems that use 12 sectors for a clock.
Let's attempt to find a counterexample that would differentiate between 4 and 12 and see which one is more plausible. Consider point (1, sqrt(3)? But coordinates are integers, so we can't test that. But for integer points, 4-sector and 12-sector may sometimes coincide. The difference arises when the point lies in a quadrant but not in the same 30° sector? Actually, quadrant boundaries are at axes (0°,90°,180°,270°). The 12-sector boundaries are at multiples of 30°, which subdivide each quadrant into three sectors (except that axes are boundaries). In quadrant I (x>0,y>0), the sectors are: 0-30°, 30-60°, 60-90°. So the color parity within a quadrant will alternate with each 30° sector. So for points in quadrant I, the color could be black for some and white for others depending on the specific angle. In 4-sector model, all points in quadrant I have the same color for a given ring parity (if we use quadrant index). For ring 2 (even) and Q1 index 0, color = even => black. So all points in Q1 with even floor(r) would be black, with odd floor(r) would be white. In 12-sector model, within Q1, colors alternate with sector index: for a given ring, sectors 0,2 are one color, sector 1 is the other (if parity (d + sector) even => black). So points in Q1 can be both black and white for the same ring.
Thus, to differentiate, we can test a point in Q1 with an angle in 30-60°, for a given ring, and see if the color predicted by 4-sector differs from 12-sector. For example, take ring 1 (d=1). Points in Q1: if 4-sector model, for d=1 (odd), Q1 index 0, (1+0)=1 odd -> white. So all Q1 points with d=1 would be white. In 12-sector, for d=1, sector 0 (0-30°) gives (1+0)=1 odd -> white; sector 1 (30-60°) gives (1+1)=2 even -> black; sector 2 (60-90°) gives (1+2)=3 odd -> white. So in Q1, some points would be black (those in sector 1). So if we can find an integer point in Q1 with d=1 and angle between 30° and 60°, that would be black in 12-sector but white in 4-sector. Does such an integer point exist? Need integer coordinates (x,y) with x>0,y>0, floor(sqrt(x^2+y^2))=1, and angle between 30 and 60 degrees. Since d=1 means sqrt(x^2+y^2) between 1 and 2, but less than 2. So possible points: (1,0) is on axis, border -> black in both. (0,1) border. (1,1): distance sqrt2≈1.414, floor=1, angle 45°, which is between 30 and 60. So (1,1) qualifies. In 12-sector, it would be black as we computed. In 4-sector, it would be white (since d=1 odd, Q1 index 0, sum odd -> white). So the two models give different predictions for (1,1). So if we could know the correct answer for (1,1), we could decide.
Is (1,1) likely black or white? Let's try to imagine the picture. If the clock has 12 sectors, the central region (first ring) would have alternating colors like a pie. Typically, if you have 12 sectors and rings alternating, the pattern would be like a checkerboard on a polar grid. The origin is black (border). The first ring (0<r<1) is divided into 12 slices. If sector 0 is black, then sector 1 would be white, sector 2 black, etc. That would give a pattern where near the