Prime Sums

Time limit: 0.2s Memory limit: 32MB Input: Output:

You are given an integer nn and your task is to check how many numbers from 11 to nn can be written as sum of kk not necessary distinct prime numbers.

As this is too easy, you will have to check whether this is possible or not for qq such numbers.

Input

The first line will consist of only one number qq, representing the number of queries.

The next qq lines will consist of two integers nn and kk

Output

The output will consist of qq lines, each having a single element representing the answer of the problem.

Constraints

  • 1q1051 ≤ q ≤ 10^5
  • 1n10181 ≤ n ≤ 10^{18}
  • 3k1093 ≤ k ≤ 10^9
  • For tests worth 10 points, q=1,3n,k200q = 1, 3 ≤ n, k ≤ 200
  • For tests worth 20 more points, q=1,1nk106q = 1, 1 ≤ n \cdot k ≤ 10^6
  • For tests worth 30 more points, 1n1061 ≤ n ≤ 10^6

Example

stdin

4
7 3
10 4
11 5
7 4

stdout

2
3
2
0

Log in or sign up to be able to send submissions!