#include #include #include using namespace std; using mint=atcoder::modint998244353; mint H(long a,int b) { //H(a,b)=C(a+b-1,b) mint x=1,y=1; for(int i=1;i<=b;i++)x*=a+b-i,y*=i; return x/y; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T;cin>>T; for(;T--;) { long N,S; cin>>N>>S; mint ans=S; for(int p=2;p<=100;p++)if(N%p==0) { int e=0; while(N%p==0)N/=p,e++; const mint invp=mint(p).inv(); mint now=0,pp=mint(p).pow(e); for(int f=e;f>=0;f--) { //pp=p.pow(e)*H(S-1,e-f) //=p.pow(e)*C(S-2+e-f,e-f) //=p.pow(e)*(S-2+e-f)...(S-2+1)/(e-f)! now+=pp; pp*=S-2+e-f+1; pp/=e-f+1; pp*=invp; } ans*=now; } cout<