#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, m, n, ans, v[1000107][27], co = 1000000007;
int main() {
  for (int i = 1; i <= 1000100; i++) {
    v[i][0] = 1;
    if (i <= 20) v[i][i] = 1;
    for (int j = 1; j <= min(i - 1, 20); j++)
      v[i][j] = (v[i - 1][j] + v[i - 1][j - 1]) % co;
  }
  scanf("%I64d", &a);
  for (int i = 1; i <= a; i++) {
    scanf("%I64d%I64d", &b, &c);
    ans = 1;
    while (b > 1) {
      d = 0;
      for (int j = 2; j * j <= b; j++)
        if (b % j == 0) {
          d = 1;
          n = 0;
          while (b % j == 0) {
            b /= j;
            n++;
          }
          ans = (ans * v[n + c - 1][n]) % co;
          break;
        }
      if (d == 0 && b > 1) {
        ans = (ans * c) % co;
        break;
      }
    }
    c--;
    d = 2;
    while (c > 0) {
      if (c % 2 == 1) ans = (ans * d) % co;
      d = (d * d) % co;
      c /= 2;
    }
    printf("%I64d\n", ans);
  }
}
