#include <bits/stdc++.h>
using namespace std;
const int buf_size = 1e5 + 5;
char buf[buf_size], *S, *T;
inline char gc() {
  if (S == T) T = (S = buf) + fread(buf, 1, buf_size, stdin);
  return S != T ? *(S++) : EOF;
}
inline int in() {
  int x = 0, f = 1;
  char c = gc();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = gc();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = gc();
  return x * f;
}
const int N = 2e6 + 5, mod = 1e9 + 7;
int q, x, y, n = 2000000, ans;
int inv[N], fac[N], finv[N];
int pri[N], pc, c[N];
int p[N];
bool inp[N];
int a[105], ac;
inline int add(const int &a, const int &b) {
  return a + b >= mod ? a + b - mod : a + b;
}
inline int mul(const int &a, const int &b) { return 1ll * a * b % mod; }
inline int C(const int &a, const int &b) {
  return mul(fac[a], mul(finv[b], finv[a - b]));
}
int main() {
  inv[1] = fac[0] = fac[1] = finv[0] = finv[1] = 1;
  for (int i = 2; i <= n; i++) {
    inv[i] = mul(mod - mod / i, inv[mod % i]);
    fac[i] = mul(fac[i - 1], i);
    finv[i] = mul(finv[i - 1], inv[i]);
  }
  for (int i = 2; i <= n; i++) {
    if (!inp[i]) pri[++pc] = i, c[i] = i;
    for (int j = 1; j <= pc && i * pri[j] <= n; j++) {
      inp[i * pri[j]] = 1;
      c[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) break;
    }
  }
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = mul(p[i - 1], 2);
  q = in();
  while (q--) {
    x = in(), y = in();
    ac = 0, ans = 0;
    int res = 1;
    while (x > 1) {
      a[++ac] = c[x];
      x /= c[x];
    }
    for (int i = 1, j; i <= ac; i = j + 1) {
      j = i;
      while (j + 1 <= ac && a[j + 1] == a[i]) j++;
      res = mul(res, C(j - i + y, y - 1));
    }
    ans = mul(res, p[y - 1]);
    printf("%d\n", ans);
  }
  return 0;
}
