Manish like to play with bits, so he was recently gifted with a puzzle book on bits arithmetic by one of his friend on his birthday.

Manish couldn't solve any of the puzzles from the book and needs your help to solve one.
Given two integers m & n .Find the number of combinations of bit-size 'n' in which there are no 'm' consecutive '1'. 

Input

The first line of the input contains an integer T denoting the number of test cases.

Each test consist of single line containing two integers m and n.

Output

For each test case, output a single line containing an integer corresponding to the
number of combinations of bit size n in which no m consecutive 1's occur.

Constraints

1 ≤ T ≤ 50

1 ≤ n ≤ 50

2 ≤ m ≤ 10

SAMPLE INPUT
1
2 3

SAMPLE OUTPUT
5

Explanation

The 3-bit combinations which satisfy our problem statement are 000 001 010 100 101.
import sys
tc=int(raw_input())
for x in range(0,tc) :
    
    (k, n) = map(int,raw_input().split())
    s = [0]*(500)
    s[k] = 1 # T(k, k) = 1
    for i in range(k + 1, n + 1):
        s[i] = 2*s[i-1] + pow(2, (i - k - 1)) - s[i-1-k]
    a = s[n]    
    print pow(2,n)-a