Given an array of integers a_1,a_2,...,a_n and integers , you can do the following operation :
Choose an index and integer such that (t \ge m) and perform a_i \leftarrow (a_i+t) \bmod k.
^{\text{*}} We call an array increasing if a_1 \le a_2 \le a_3 \le ... \le a_n holds.
You're asked to determine the minimum number of operations needed to transform the array into an increasing array (if possible) , otherwise print .
The first line of each test case contains single integer (1 \le t \le 10^4) — the number of test cases.
The first line of each test case contains three integers n,m,k (1 \le n \le 10^6 ; 1 \le m,k \le 10^9) — the length of array , the minimum increment bound and the modulus operation parameter respectively.
The second line of each test case contains separated integers a_1,a_2,...,a_n (1 \le a_1,a_2,...,a_n \le 10^9) — the array .
It's guaranteed that \sum n \le 10^6 overall test cases
For each test case , if it's possible to make array increasing , print single integer the minimum number of operations required to achieve so.
Example 1
In the first test case , It's optimal to perform the following :
Choose i=1 and t=4 then a_i=(7+4) \bmod 5 =0.
The array becomes a=[1,1,2] which is increasing.
In the second case , It's optimal to perform nothing since is already increasing.
In the third case , It's optimal to perform the following :
Choose i=3 and t=4 then a_i=(4+4) \bmod 6 =2 then a=[2,2,2,1,3]
Choose i=4 and t=1 then a_i=(1+1) \bmod 6 =2 then a=[2,2,2,2,3]
The final array is a=[2,2,2,2,3] which is increasing.
In the fourth case , It's optimal to perform the following :
Choose i=1 and t=12 then a_i=(8+12) \bmod 10 =0 then a=[0,15,3,9,1,12]
Choose i=2 and t=5 then a_i=(15+5) \bmod 10 =0 then a=[0,0,3,9,1,12]
Choose i=5 and t=8 then a_i=(1+8) \bmod 10 =9 then a=[0,0,3,9,9,12]
The final array is a=[0,0,3,9,9,12] which is increasing.
In the fifth case , It's optimal to perform the following :
Choose i=1 and t=10 then a_i=(10+10) \bmod 10 =0 then a=[0,7,3,1,8,12]
Choose i=2 and t=3 then a_i=(7+3) \bmod 10 =0 then a=[0,0,0,1,8,12]
Choose i=3 and t=7 then a_i=(3+7) \bmod 10 =0 then a=[0,0,0,1,8,12]
The final array is a=[0,0,0,1,8,12] which is increasing.
Subtask ( points) : (a_1=a_2=a_3=...=a_n)
Subtask ( points) : (k=1)
Subtask ( points) : (n,k \le 4)
Subtask ( points) : (k=2)
Subtask ( points) : (1 \le \sum n \le 2000)
Subtask ( points) : No additional constraints