#P15483. [CERC2012] Darts

[CERC2012] Darts

Description

Consider a game in which darts are thrown at a board. The board is formed by 1010 circles with radii 2020, 4040, 6060, 8080, 100100, 120120, 140140, 160160, 180180, and 200200 (measured in millimeters), centered at the origin. Each throw is evaluated depending on where the dart hits the board. The score is pp points (p{1,2,,10}p\in\{1,2,\dots,10\}) if the smallest circle enclosing or passing through the hit point is the one with radius 20(11p)20\cdot(11-p). No points are awarded for a throw that misses the largest circle. Your task is to compute the total score of a series of nn throws.

Input Format

The first line of the input contains the number of test cases TT. The descriptions of the test cases follow:

Each test case starts with a line containing the number of throws nn (1n1061\le n\le 10^6). Each of the next nn lines contains two integers xx and yy (200x,y200−200\le x,y\le 200) separated by a space—the coordinates of the point hit by a throw.

Output Format

Print the answers to the test cases in the order in which they appear in the input. For each test case print a single line containing one integer—the sum of the scores of all nn throws.

1
5
32 -39
71 89
-60 80
0 0
196 89
29