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!