Ran is a puzzle lover and loves solving all kinds of math puzzles. One day, Cirno gives her an easy equation: ka+b=cka+b=cka+b=c.
Cirno gives the value of kkk, ccc and nnn, and want to know how many positive integer pairs (a,b)(a,b)(a,b) satisfy ka+b=cka+b=cka+b=c, b∣cb|cb∣c (that means c=xbc=xbc=xb, x≥1x\ge1x≥1 and xxx is an integer) and gcd(a,b)≥n\gcd(a,b)\ge ngcd(a,b)≥n.
Cirno will ask qqq questions (that means there'll be qqq data cases). Help Ran answer them!
输入格式
The first line contains on integer qqq (1≤q≤1001\le q\le 1001≤q≤100), means the number of test cases.
For the next qqq lines, each line contains three integers k,c,nk,c,nk,c,n (1≤k,c,n≤1091\le k,c,n\le 10^91≤k,c,n≤109).
输出格式
For each question, output a single integer representing the number of pairs (a,b)(a,b)(a,b) satisfying all restrictions.