Problem: Ntarsis has received two integers and for his birthday. He wonders how many fibonacci-like sequences of length can be formed with as the -th element of the sequence.
A sequence of non-decreasing non-negative integers is considered fibonacci-like if for all , where denotes the -th element in the sequence. Note that and can be arbitrary.
For example, sequences such as and are considered fibonacci-like sequences, while , , and are not: the first two do not always satisfy , the latter does not satisfy that the elements are non-negative.
Impress Ntarsis by helping him with this task.
Input Format: The first line contains an integer (), the number of test cases. The description of each test case is as follows.
Each test case contains two integers, and (, ).
It is guaranteed the sum of over all test cases does not exceed .
Output Format: For each test case output an integer, the number of fibonacci-like sequences of length such that the -th element in the sequence is . That is, output the number of sequences of length so is a fibonacci-like sequence and . It can be shown this number is finite.
Note: There are valid fibonacci-like sequences for , :
- ,
- ,
- ,
- .
For , , it can be shown that there are no fibonacci-like sequences satisfying the given conditions.
For , , is the only fibonacci-like sequence.