import math from collections import defaultdict # 試し割り法 O(√N) def prime_factors(src): # cnt: 素因数の数 cnt = 0 now = src i = 2 # src = i*j のときjがiより大きいなら既出なので√srcまで確認 while i*i <= src: # 割り切れるなら割れるだけ割る while now%i == 0: now //= i cnt += 1 i += 1 # それ以上分解できない残ったものを素因数に加える if now > 1: cnt += 1 return cnt MOD = 998244353 # O(N*√N) # print(10**5*math.sqrt(10**5)) memo = defaultdict(int) Q = int(input()) cnt = 0 for _ in range(Q): A, B = map(int, input().split()) if memo[A] == 0: memo[A] = prime_factors(A) cnt += memo[A] print(math.comb(cnt-1, B-1)%MOD)