{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e Matt loves letter L.\u003cbr\u003e\u003cbr\u003e A point set P is (a, b)-L if and only if there exists x, y satisfying:\u003cbr\u003e\u003cbr\u003e \u003cb\u003eP \u003d {(x, y), (x + 1, y), . . . , (x + a, y), (x, y + 1), . . . , (x, y + b)}(a, b ≥ 1)\u003c/b\u003e\u003cbr\u003e\u003cbr\u003e A point set Q is good if and only if Q is an (a, b)-L set and gcd(a, b) \u003d 1.\u003cbr\u003e\u003cbr\u003e Matt is given a point set S. Please help him find the number of ordered pairs of sets (A, B) such that:\u003cbr\u003e\u003cbr\u003e \u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/6cdc466e4f1314d324205f95a7ca622a?v\u003d1726093597\"\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":" The first line contains only one integer T , which indicates the number of test cases.\u003cbr\u003e\u003cbr\u003e For each test case, the first line contains an integer N (0 ≤ N ≤ 40000), indicating the size of the point set S.\u003cbr\u003e\u003cbr\u003e Each of the following N lines contains two integers x\u003csub\u003ei\u003c/sub\u003e, y\u003csub\u003ei\u003c/sub\u003e, indicating the i-th point in S (1 ≤ x\u003csub\u003ei\u003c/sub\u003e, y\u003csub\u003ei\u003c/sub\u003e ≤ 200). It’s guaranteed that all (x\u003csub\u003ei\u003c/sub\u003e, y\u003csub\u003ei\u003c/sub\u003e) would be distinct."}},{"title":"Output","value":{"format":"HTML","content":" For each test case, output a single line “Case #x: y”, where x is the case number (starting from 1) and y is the number of pairs."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n6\r\n1 1\r\n1 2\r\n2 1\r\n3 3\r\n3 4\r\n4 3\r\n9\r\n1 1\r\n1 2\r\n1 3\r\n2 1\r\n2 2\r\n2 3\r\n3 1\r\n3 2\r\n3 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 2\r\nCase #2: 6\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"n the second sample, the ordered pairs of sets Matt can choose are:\u003cbr\u003eA \u003d {(1, 1), (1, 2), (1, 3), (2, 1)} and B \u003d {(2, 2), (2, 3), (3, 2)}\u003cbr\u003eA \u003d {(2, 2), (2, 3), (3, 2)} and B \u003d {(1, 1), (1, 2), (1, 3), (2, 1)}\u003cbr\u003eA \u003d {(1, 1), (1, 2), (2, 1), (3, 1)} and B \u003d {(2, 2), (2, 3), (3, 2)}\u003cbr\u003eA \u003d {(2, 2), (2, 3), (3, 2)} and B \u003d {(1, 1), (1, 2), (2, 1), (3, 1)}\u003cbr\u003eA \u003d {(1, 1), (1, 2), (2, 1)} and B \u003d {(2, 2), (2, 3), (3, 2)}\u003cbr\u003eA \u003d {(2, 2), (2, 3), (3, 2)} and B \u003d {(1, 1), (1, 2), (2, 1)}\u003cbr\u003eHence, the answer is 6.\u003cbr\u003e"}}]}