P12751 [HackerEarth] palindromic prime
普及
题目描述

Consider the palindromic prime numbers(Numbers which are palindrome as well as prime).Let p be the product of non zero digits of a nth palindromic prime number.Let product of digits of a palindromic prime is multiplied by a number m to generate number q(q=p*m).Your task is simple; you have to find number of divisors of q.

INPUT:

First Line contains number of test cases t.
Second line contains two space separated numbers n and m.

OUTPUT:

Output each test case in new line number of divisors of q.

CONSTRAINTS:

t ≤ 10000
n ≤ 113
1 ≤ m ≤ 100

SAMPLE INPUT
1
2 1

SAMPLE OUTPUT
2

Explanation

2nd palindromic prime is 3 value of m is 1 so value of q is 3.Numbers of divisors of 3 is 2(1 and 3)

输入格式

见题面

输出格式

见题面

样例输入
1 2 1 SAMPLE
样例输出
2