#include #define _1 (__int128)1 using namespace std; using ll = long long; void FileIO (const string s) { freopen(string(s + ".in").c_str(), "r", stdin); freopen(string(s + ".out").c_str(), "w", stdout); } const int N = 2e6 + 10, mod = 998244353; int n, inv[N], x[N], f[N], a, b, ans; bool ip[N]; inline int C (int a, int b) { if (a < b) return 0; return 1ll * f[a] * x[b] % mod * x[a - b] % mod; } signed main () { ios::sync_with_stdio(0), cin.tie(0); // FileIO(""); inv[1] = x[0] = f[0] = 1; for (int i = 2; i <= 2e6; i++) inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod; for (int i = 1; i <= 2e6; i++) x[i] = 1ll * x[i - 1] * inv[i] % mod, f[i] = 1ll * f[i - 1] * i % mod; for (cin >> n; n--; ) { cin >> a >> b; for (int i = 2; i * i <= a; i++) while (a % i == 0) a /= i, ans++; if (a > 1) ans++; cout << C(ans - 1, b - 1) << '\n'; } return 0; }