import math mod=998244353 def solve(): a,b,c=map(int,input().split()) if (a**200)%c!=0: print(0) return g=math.gcd(a,c**200) a=g res=1 ans=0 while b>0 and a!=1: a_tmp=a d=1 while a_tmp%c!=0 and d