Brandon threw a party where lots of fireworks were detonated. In particular, Brandon detonated unique fireworks. He now has a lot of fireworks to clean up.
Brandon has trash cans, each of which can store up to firework wrappers. Brandon will execute a move that he has dubbed the Trash Push, where he takes all of the firework wrappers he has and pushes them into the nearest trash can. Brandon is so skilled at executing the Trash Push that if there are too many firework wrappers in the nearest trash can, exactly the overflowing wrappers will fall into another trash can. This process of exactly the overflowing trash falling into another trash can will continue until no trash can is overflowing.
After Brandon executes the Trash Push on the firework wrappers he has, how many trash cans will have at least one firework wrapper in them?
Constraints
Input Specification
The first line contains a single positive integer , the number of test cases.
lines follow. Each of these lines contains two space-separated positive integers, and .
Output Specification
Output lines. On the th line, output the number of trash cans that have at least one firework wrapper in them for the th test case.
Sample Input
3
1 1
3 14
3939 39
Sample Output
1
1
101
Comments