Problem hidden

NDT - New Data Type

Little boy maze invented a brand new data type that can store data from 1 to M inclusive. The specialty of the invented data type is if you want to store a data out of the range it can round the data and map with invented data type.

for example if the range is 1 to 7 and you want to store 9 then the system round 9 and map with 2.

Now you're given a number in the format  AB and the upper limit M of range. Can you round the number to map with new data type?

Input

Input starts with T ≤ 100000.

in the next T lines there will be three integers (1 ≤ A, B ≤ 1000000000000000000, 1 < M < 1000000000).

Output

For each case print the desire output.

Example

Input:
2
2 3 5
4 2 15

Output:
3
1

Adicionado por:Jisan
Data:2019-04-30
Tempo limite:1s
Tamanho do fonte:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Linguagem permitida:Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.