#include using namespace std; long long mod = 998244353; //入力が必ず-mod>= 1; } return ret; }; mint &operator=(const mint &b) = default; mint operator-() const {return mint(0)-(*this);} mint operator+(const mint b){return mint(v)+=b;} mint operator-(const mint b){return mint(v)-=b;} mint operator*(const mint b){return mint(v)*=b;} mint operator/(const mint b){return mint(v)/=b;} mint operator+=(const mint b){ v += b.v; if(v >= mod) v -= mod; return *this; } mint operator-=(const mint b){ v -= b.v; if(v < 0) v += mod; return *this; } mint operator*=(const mint b){v = v*b.v%mod; return *this;} mint operator/=(mint b){ if(b == 0) assert(false); int left = mod-2; while(left){if(left&1) *this *= b; b *= b; left >>= 1;} return *this; } mint operator++(int){*this += 1; return *this;} mint operator--(int){*this -= 1; return *this;} bool operator==(const mint b){return v == b.v;} bool operator!=(const mint b){return v != b.v;} bool operator>(const mint b){return v > b.v;} bool operator>=(const mint b){return v >= b.v;} bool operator<(const mint b){return v < b.v;} bool operator<=(const mint b){return v <= b.v;} mint pow(const long long x){return repeat2mint(v,x);} mint inv(){return mint(1)/v;} }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); vector prime(100001,true); vector sume(100001); for(int i=2; i<=100000; i++){ if(prime.at(i) == false) continue; for(int k=i; k<=100000; k+=i){ prime.at(k) = false; int e = 0,x = k; while(x%i == 0) e++,x /= i; sume.at(k) += e; } } int Limit = 1000000; vector fac(Limit+1,1),inv(Limit+1,1),facinv(Limit+1,1); for(int i=1; i<=Limit; i++) fac.at(i).v = fac.at(i-1).v*i %mod; for(int i=2; i<=Limit; i++) inv.at(i).v = mod-(mod/i*inv.at(mod%i).v %mod); for(int i=2; i<=Limit; i++) facinv.at(i).v = facinv.at(i-1).v*inv.at(i).v %mod; auto nCr = [&](int n, int r) -> mint { if(n < r || r < 0 || n < 0) return mint(0); return fac.at(n)*facinv.at(r)*facinv.at(n-r); }; int E = 0,Q; cin >> Q; while(Q--){ int a,b; cin >> a >> b; E += sume.at(a); cout << nCr(E-1,E-b).v << "\n"; } }