#nt501. 扩展欧几里得3
扩展欧几里得3
Extended Euclidean Algorithm 3
Problem Description
You are given test cases. Each case provides ; output how many integer solutions of satisfy and .
Input Format
The first line contains an integer .
The following lines each contain seven numbers: .
Output Format
Output lines, each containing one number: the answer for that case.
Sample Input
3
1 2 5 0 10 0 10
100 150 1000 -10 0 0 10
3 2 1 0 100 0 100
Sample Output
3
2
0
Constraints
For of the data: , , , , .