#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O0")
#pragma GCC optimize("O1")
long long pw(long long a, long long b) {
  long long ret = 1;
  long long mul = a;
  while (b > 0) {
    if (b & 1) ret = (ret * mul) % (1000000007);
    mul = (mul * mul) % (1000000007);
    b /= 2;
  }
  return ret;
}
long long to_int(string s) {
  long long ret = 0;
  for (int(i) = (0); (i) < (s.size()); (i)++) {
    ret += pw(10, s.size() - i - 1) * (long long)(s[i] - '0');
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  int tt;
  cin >> tt;
  vector<vector<long long> > bin(1000100);
  for (int(i) = (0); (i) < (1000100); (i)++) bin[i].resize(min(i + 1, 25));
  for (int(i) = (0); (i) < (1000100); (i)++) {
    if (i < 25) bin[i][i] = 1;
    bin[i][0] = 1;
  }
  for (int(i) = (1); (i) < (1000100); (i)++) {
    for (int(j) = (1); (j) < (min(i, 25)); (j)++) {
      bin[i][j] = (bin[i - 1][j] + bin[i - 1][j - 1]) % (1000000007);
    }
  }
  while (tt--) {
    int x, n;
    cin >> x >> n;
    vector<int> pf;
    int bs = x;
    for (int i = 2; i * i <= bs; i++) {
      long long a = 0;
      while (x % i == 0) x /= i, a++;
      if (a) pf.push_back(a);
      if (x == 1) break;
    }
    if (x != 1) pf.push_back(1);
    long long ans = 1;
    for (int(i) = (0); (i) < (pf.size()); (i)++) {
      int k = pf[i];
      ans = (ans * (bin[n + k - 1][k])) % (1000000007);
    }
    ans = (ans * pw(2, n - 1)) % (1000000007);
    cout << ans << "\n";
  }
}
