{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eDr. Hanks is a well-known expert in the field of Bio-Tech. His son\u0027s name is Hankson. Now, Hankson, who has just returned home from school, is pondering an interesting problem.\u003c/p\u003e\n\u003cp\u003eToday in class, the teacher explained how to find the greatest common divisor and least common multiple of two positive integers $c_1$ and $c_2$. Now Hankson believes that he has mastered this knowledge proficiently, and he starts thinking about the \"inverse problem\" of problems like \"finding the greatest common divisor\" and \"finding the least common multiple.\" The problem is as follows: Given a positive integer $a_0,a_1,b_0,b_1$, suppose there exists an unknown positive integer x that satisfies:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eThe greatest common divisor of $x$ and $a_0$ is $a_1$;\u003c/li\u003e\n\u003cli\u003eThe least common multiple of $x$ and $b_0$ is $b_1$.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eHankson\u0027s \"inverse problem\" is to find the positive integer $x$ that satisfies the given conditions. However, after some thought, he realizes that such $x$ may not be unique, and it may not even exist. Therefore, he turns to consider how to determine the number of $x$ that satisfy the given conditions. Please help him write a program to solve this problem.\u003c/p\u003e\n\u003ch4\u003eInput Format\u003c/h4\u003e\n\u003cp\u003eThe first line contains a positive integer $n$, indicating the number of test cases. The next $n$ lines each contain a test case, consisting of four positive integers $a_0$, $a_1$, $b_0$, $b_1$, separated by a space. It is guaranteed that $a_0$ is divisible by $a_1$, and $b_1$ is divisible by $b_0$.\u003c/p\u003e\n\u003ch4\u003eOutput Format\u003c/h4\u003e\n\u003cp\u003eFor each test case: If there is no such $x$, please output $0$;\u003c/p\u003e\n\u003cp\u003eIf there is such $x$, please output the number of $x$ that satisfy the given conditions;\u003c/p\u003e\n\u003ch4\u003eData Constraints\u003c/h4\u003e\n\u003cp\u003eFor the data of $50\\%$, it is guaranteed that there are $1 \\le a_0$, $b_1$, $b_0$, $b_1 \\le 10000$, and $n \\le 100$.\u003c/p\u003e\n\u003cp\u003eFor the data of $100\\%$, it is guaranteed that there are $1 \\le a_0$, $b_1$, $b_0$, $b_1 \\le 2,000,000,000$, and $n \\le 2000$.\u003c/p\u003e"}},{"title":"Sample 1","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\n41 1 96 288\n95 1 37 1776\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\n2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e\u003cp\u003eFor the first test case, $x$ can be $9$, $18$, $36$, $72$, $144$, or $288$, with a total of $6$ possibilities.\u003c/p\u003e\n\u003cp\u003eFor the second test case, $x$ can be $48$, or $1776$, with a total of $2$ possibilities.\u003c/p\u003e"}}]}