Consider an integer sequence consisting of elements:
You are given , , , , and . Find the number of consecutive subsequences whose sum is divisible by .
For example, let a = 2, b = 1, c = 2, m = 4, n = 4. Then
So, x_0 = 2, x_1 = 1, x_2 = 4, x_3 = 3. The consecutive subsequences are , , \{2, 1, 4\}, \{2, 1, 4, 3\}, , , \{1, 4, 3\}, , , and . Of these consecutive subsequences, only two have a sum divisible by : \{1, 4, 3\} and .
The first line contains the number of tests (t < 500). Each of the following lines contains a separate test, consisting of five integers: , , , , (0 \leq a, b, c \leq 1000, 0 < m, n \leq 10000).
For each test, output its number and the required result on a separate line.
Example 1