We want to express a positive integer N as a sum of prime numbers. Let G(N,K) denote the number of ways to decompose N using primes pi that are less than or equal to K. That is, N is written as a sum of primes:
N=p1+p2+p3+⋯+pr,(pi≤K)
Recall that the smallest prime is 2.
This decomposition carries one extra rule. The graceful rule requires that every pair of adjacent primes be different, that is pi=pi+1 for all i. We call such a decomposition a Graceful Prime Decomposition (GPD), written compactly as N=(p1,p2,p3,…,pr).
Order matters: 2+5 and 5+2 are counted as two different decompositions.
For example, G(7,5)=3:
and G(5,5)=3:
Note that 7=2+2+3 is not a valid GPD, because the adjacent pair 2+2 is equal. Likewise (2,3,2) is valid but (3,2,2) is not. Compute G(N,K) for the given integers N and K.
The first line contains the number of test cases T. Each test case is a single line with two integers N and K, where 2≤N,K≤50.
For each test case, print a single integer G(N,K) on its own line.