It's tough to be a superhero. And it's twice as tough to resist the supervillain who is cool at math. Suppose that you're an ordinary Batman in an ordinary city of Gotham. Your enemy Joker mined the building of the city administration and you only have several minutes to neutralize the charge. To do that you should enter the cancel code on the bomb control panel.However, that mad man decided to give you a hint. This morning the mayor found a playing card under his pillow. There was a line written on the card:The bomb has a note saying "J(x) = A", where A is some positive integer. You suspect that the cancel code is some integer x that meets the equation J(x) = A. Now in order to decide whether you should neutralize the bomb or run for your life, you've got to count how many distinct positive integers x meet this equation.

The single line of the input contains a single integer A (1 ≤ A ≤ 1012).

Print the number of solutions of the equation J(x) = A.

NoteRecord x|n means that number n divides number x. is defined as the largest positive integer that divides both a and b.In the first sample test the only suitable value of x is 2. Then J(2) = 1 + 2.In the second sample test the following values of x match:  x = 14, J(14) = 1 + 2 + 7 + 14 = 24  x = 15, J(15) = 1 + 3 + 5 + 15 = 24  x = 23, J(23) = 1 + 23 = 24

#include <stdio.h>

#define MAX 1000010

int p, primes[78777], flag[MAX] = {0};

void Sieve(){
    int i, j, d;

    flag[2] = 1;
    for (i = 3; i < MAX; i++, i++) flag[i] = 1;
    for (i = 3; i < 1001;){
        d = i << 1;
        for (j = (i * i); j < MAX; j += d) flag[j] = 0;

        i++, i++;
        while (!flag[i]) i++, i++;
    }

    p = 0;
    for (i = 0; i < MAX; i++){
        if (flag[i]) primes[p++] = i;
    }
}

int isPrime(long long x){
    if ((x < 2)) return 0;

    int i;
    for (i = 0; ; i++){
        long long y = primes[i];
        if ((y * y) > x) return 1;
        if ((x % y) == 0) return 0;
    }
}

int F(int i, long long a){
    if (a == 1) return 1;
    long long y = primes[i];
    if ((y + 1) > a) return 0;

    if (((y * y) + 1) > a){
        if (isPrime(a - 1)) return 1;
        return 0;
    }

    long long x = 1;
    int res = F(i + 1, a);

    for (; ;){
        x *= y;
        if ((x + 1) > a) break;

        if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));
    }
    return res;
}

int Solve(long long a){
    if (a < 5) return (a != 2);
    return F(0, a);
}

int main(){
    Sieve();
    long long a;
    while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
    return 0;
}

#include <stdio.h>

#define MAX 1000010

int p, primes[78777], flag[MAX];

void Sieve(){
    int i, j, d;

    flag[2] = 1;
    for (i = 3; i < MAX; i++, i++) flag[i] = 1;
    for (i = 3; i < 1001;){
        d = i << 1;
        for (j = (i * i); j < MAX; j += d) flag[j] = 0;
        do{
            i++;
        }while (!flag[++i]);
    }

    for (i = 0; i < MAX; i++){
        if (flag[i]) primes[p++] = i;
    }
}

int isPrime(long long x){
    int i;
    for (i = 0; ; i++){
        long long y = primes[i];
        if ((y * y) > x) return 1;
        if ((x % y) == 0) return 0;
    }
}

int F(int i, long long a){
    if (a == 1) return 1;
    long long y = primes[i];
    if ((y + 1) > a) return 0;

    if (((y * y) + 1) > a){
        if (isPrime(a - 1)) return 1;
        return 0;
    }

    long long x = 1;
    int res = F(i + 1, a);

    for (; ;){
        x *= y;
        if ((x + 1) > a) break;

        if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));
    }
    return res;
}

int Solve(long long a){
    if (a < 5) return (a != 2);
    return F(0, a);
}

int main(){
    Sieve();
    long long a;
    while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
    return 0;
}

#include <stdio.h>
#include <string.h>

#define MAX 1000010
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)

int p, primes[78777], flag[MAX] = {0};

void Sieve(){
    int i, j, d;

    flag[2] = 1;
    for (i = 3; i < MAX; i++, i++) flag[i] = 1;
    for (i = 3; i < 1001;){
        d = i << 1;
        for (j = (i * i); j < MAX; j += d) flag[j] = 0;

        i++, i++;
        while (!flag[i]) i++, i++;
    }

    p = 0;
    for (i = 0; i < MAX; i++){
        if (flag[i]) primes[p++] = i;
    }
}

int isPrime(long long x){
    if ((x < 2) || !(x & 1)) return 0;

    int i;
    for (i = 1; i < p; i++){
        long long y = primes[i];
        if ((y * y) > x) return 1;
        if ((x % y) == 0) return 0;
    }
    return 1;
}

int F(int i, long long a){
    if (a == 1) return 1;
    long long y = primes[i];
    if ((y + 1) > a) return 0;

    if ((i == p) || ( ((y * y) + 1) > a) ){
        if ((primes[i - 1] + 1) < a){
            if (isPrime(a - 1)) return 1;
            return 0;
        }
        return 0;
    }

    long long x = 1;
    int res = F(i + 1, a);

    for (; ;){
        x *= y;
        if ((x + 1) > a) break;

        if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));
    }
    return res;
}

int Solve(long long a){
    if (a < 5) return (a != 2);
    return F(0, a);
}

int main(){
    Sieve();
    long long a;
    while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
    return 0;
}

#include <stdio.h>
#include <string.h>

#define MAXI 100
#define MAXA 50000
#define MAX 1000010
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)

int dp[MAXI][MAXA];
int p, primes[78777], flag[MAX] = {0};

void Sieve(){
    int i, j, d;

    flag[2] = 1;
    for (i = 3; i < MAX; i++, i++) flag[i] = 1;
    for (i = 3; i < 1001;){
        d = i << 1;
        for (j = (i * i); j < MAX; j += d) flag[j] = 0;

        i++, i++;
        while (!flag[i]) i++, i++;
    }

    p = 0;
    for (i = 0; i < MAX; i++){
        if (flag[i]) primes[p++] = i;
    }
}

int isPrime(long long x){
    if ((x < 2) || !(x & 1)) return 0;

    int i;
    for (i = 1; i < p; i++){
        long long y = primes[i];
        if ((y * y) > x) return 1;
        if ((x % y) == 0) return 0;
    }
    return 1;
}

int F(int i, long long a){
    if (a == 1) return 1;
    long long y = primes[i];
    if ((y + 1) > a) return 0;

    if ((i == p) || ( ((y * y) + 1) > a) ){
        if ((primes[i - 1] + 1) < a){
            if (isPrime(a - 1)) return 1;
            return 0;
        }
        return 0;
    }
    if (i < MAXI && a < MAXA && dp[i][a] != -1) return dp[i][a];

    long long x = 1;
    int res = F(i + 1, a);

    for (; ;){
        x *= y;
        if ((x + 1) > a) break;

        if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));
    }

    if (i < MAXI && a < MAXA) dp[i][a] = res;
    return res;
}

int Solve(long long a){
    if (a < 5) return (a != 2);
    return F(0, a);
}

int main(){
    Sieve();
    memset(dp, -1, sizeof(dp));

    long long a;
    while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
    return 0;
}

#include <stdio.h>

#define MAX 1000010

int p, primes[78777], flag[MAX] = {0};

void Sieve(){
    int i, j, d;

    flag[2] = 1;
    for (i = 3; i < MAX; i++, i++) flag[i] = 1;
    for (i = 3; i < 1001;){
        d = i << 1;
        for (j = (i * i); j < MAX; j += d) flag[j] = 0;

        i++, i++;
        while (!flag[i]) i++, i++;
    }

    p = 0;
    for (i = 0; i < MAX; i++){
        if (flag[i]) primes[p++] = i;
    }
}

int isPrime(long long x){
    if ((x < 2)) return 0;

    int i;
    for (i = 0; i < p; i++){
        long long y = primes[i];
        if ((y * y) > x) return 1;
        if ((x % y) == 0) return 0;
    }
    return 1;
}

int F(int i, long long a){
    if (a == 1) return 1;
    long long y = primes[i];
    if ((y + 1) > a) return 0;

    if ((i == p) || ( ((y * y) + 1) > a) ){
        if ((primes[i - 1] + 1) < a){
            if (isPrime(a - 1)) return 1;
            return 0;
        }
        return 0;
    }

    long long x = 1;
    int res = F(i + 1, a);

    for (; ;){
        x *= y;
        if ((x + 1) > a) break;

        if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));
    }
    return res;
}

int Solve(long long a){
    if (a < 5) return (a != 2);
    return F(0, a);
}

int main(){
    Sieve();
    long long a;
    while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
    return 0;
}

#include <stdio.h>

#define MAX 1000010

int p, primes[78777], flag[MAX] = {0};

void Sieve(){
    int i, j, d;

    flag[2] = 1;
    for (i = 3; i < MAX; i++, i++) flag[i] = 1;
    for (i = 3; i < 1001;){
        d = i << 1;
        for (j = (i * i); j < MAX; j += d) flag[j] = 0;

        i++, i++;
        while (!flag[i]) i++, i++;
    }

    p = 0;
    for (i = 0; i < MAX; i++){
        if (flag[i]) primes[p++] = i;
    }
}

int isPrime(long long x){
    if ((x < 2)) return 0;

    int i;
    for (i = 0; i < p; i++){
        long long y = primes[i];
        if ((y * y) > x) return 1;
        if ((x % y) == 0) return 0;
    }
    return 1;
}

int F(int i, long long a){
    if (a == 1) return 1;
    long long y = primes[i];
    if ((y + 1) > a) return 0;

    if ((i == p) || ( ((y * y) + 1) > a) ){
        if (isPrime(a - 1)) return 1;
        return 0;
    }

    long long x = 1;
    int res = F(i + 1, a);

    for (; ;){
        x *= y;
        if ((x + 1) > a) break;

        if ((a % (x + 1)) == 0) res = res + F(i + 1, a / (x + 1));
    }
    return res;
}

int Solve(long long a){
    if (a < 5) return (a != 2);
    return F(0, a);
}

int main(){
    Sieve();
    long long a;
    while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
    return 0;
}

#include <stdio.h>

#define MAX 1000010

int p, i, j, primes[78777];

int isPrime(long long x){
    for (j = 0; ;j++){
        long long y = primes[j];
        if ((y * y) > x) return 1;
        if (!(x % y)) return 0;
    }
}

int F(int i, long long a){
    if (a == 1) return 1;
    long long x = 1, y = primes[i];
    if ((y + 1) > a) return 0;
    if (((y * y) + 1) > a) return isPrime(--a);

    int res = F(++i, a);
    for (; ;){
        x *= y;
        if ((x + 1) > a) break;
        if (!(a % (x + 1))) res = res + F(i, a / (x + 1));
    }
    return res;
}

int Solve(long long a){
    if (a < 5) return (a != 2);
    return F(0, a);
}

int main(){
    freopen("lol.txt", "r", stdin);
    primes[p++] = 2;
    for (i = 3; i < MAX; i+=2){
        if (isPrime(i)) primes[p++] = i;
    }

    long long a;
    while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
    return 0;
}


Baby Badawy's first words were "AND 0 SUM BIG", so he decided to solve the following problem. Given two integers $$$n$$$ and $$$k$$$, count the number of arrays of length $$$n$$$ such that:  all its elements are integers between $$$0$$$ and $$$2^k-1$$$ (inclusive);  the bitwise AND of all its elements is $$$0$$$;  the sum of its elements is as large as possible. Since the answer can be very large, print its remainder when divided by $$$10^9+7$$$.

The first line contains an integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases you need to solve. Each test case consists of a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 20$$$).

For each test case, print the number of arrays satisfying the conditions. Since the answer can be very large, print its remainder when divided by $$$10^9+7$$$.

#include<stdio.h>
int main(){
 int t;
 scanf("%d",&t);
 while(t--){
  int n,k;
  int max=1e9+7;
  scanf("%d%d",&n,&k);
  long long int ans=1;
  for(int i=0;i<k;i++){
   ans=(ans*n)%max;
  }
  printf("%lld\n",ans);
 }
 return 0;
}

#include <stdio.h>

int main()
{
 unsigned int t,k;
 unsigned long long int n,i;
 scanf("%u",&t);
 while(t--)
 {
     scanf("%llu%u",&n,&k);
     i=1;
     while(k--)
     {
         i=i*n%1000000007;
     }
printf("%llu",i);
printf("\n");
 }

    return 0;
}

#include <stdio.h>

enum{ MAX = 1000000007 };

int main()
{
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; ++i) {
        int n, k;
        scanf("%d%d", &n, &k);
        unsigned long long res = 1;
        for(int j = 0; j < k; ++j) {
            res *= n;
            res %= MAX;
        }
        printf("%llu\n", res);
    }
}

#include<stdio.h>
int main(){
  int t;
  scanf("%d",&t);
  while(t--){
    int n,k;
    scanf("%d %d",&n,&k);
    long long int ans = 1;
    for(int i=1; i<=k; i++){
      ans=ans*n;
      ans=ans%1000000007;
    }
    printf("%lld\n",ans);
  }
  return 0;
}

#include<stdio.h>
int main()
{
    int t;
    scanf("%d", &t);
    while(t--)
    {
        long long int n, k, c=1;
        scanf("%lld %lld", &n, &k);
        while(k--)
            c=c*n%1000000007;
        printf("%lld\n", c);
    }
}

#include<stdio.h>
int main() {
	int t; scanf("%d", &t);
	int mod = 1e9 + 7;
	while (t--) {
		int n, k; scanf("%d%d", &n, &k);
		long long ans = 1;
		for (int i = 0; i < k; i++) {
			ans *= n;
			ans %= mod;
		}
		printf("%lld\n", ans);
	}
}

#include<stdio.h>
#include<string.h>
const int N=1000000007;
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		long long a,b;
		scanf("%lld%lld",&a,&b);
		long long t=1;
		while(b--){
			t=t*a;
			t=t%N;
		}
		printf("%lld\n",t);
	}
	return 0;
}

#include<stdio.h>
//using namespace std;
int main()
{
    int n,k,i,T;
    long long ans=1LL;
    long long mod=(1E9)+7;
    scanf("%d",&T);
    while(T--)
    {
        ans=1LL;
    scanf("%d%d",&n,&k);
    for(i=0;i<k;i++)
    {
        ans=(ans*n)%mod;
    }
    printf("%lld\n",ans);
     }
}

#include <stdio.h>

#define M 1000000007

int min(int a, int b) { return a < b ? a : b; }

int main()
{
     int x,y,z,i,j,k,a,b,c,n,m,t;
     long long res;

     scanf("%d",&t);
     while(t--)
     {
           res = 1;
           scanf("%d %d",&n,&k);
           //k = min(n, k);
           for(x = 0; x < k; x++)
               res = (res * n) % M;

           printf("%lld\n",res);
     }
     return 0;
}

#include<stdio.h>

int main()
{
    long long int sum=1,n,k;
    long long int t;
    scanf("%lld",&t);
    for(long long int i=0;i<t;i++)
    {
        sum=1;
        scanf("%lld%lld",&n,&k);
        for(long long int j=0;j<k;j++)
            sum=(sum*n)%1000000007;
        printf("%lld\n",sum);
    }
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>

void solve(){
    int n, k;
    scanf("%d %d", &n, &k);
    int mod = 1e9 + 7;
    long long ans = 1;
    for(int i = 0; i < k; i++){
        ans *= n;
        ans %= mod;
    }
    printf("%d\n", ans);
    return;
}

int main(){
    int t;
    scanf("%d", &t);
    for(int tt = 0; tt < t; tt++){
        solve();
    }
    return 0;
}

#include <stdio.h>
int main()
{
    int t,n,k,max_sum;
    long long ans;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d",&n,&k);
        ans=1;
        for(int i=0;i<k;i++)
        {
            ans*=n;
            ans%=1000000007;
        }
        printf("%d\n",ans);

    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

const unsigned long long int mod=1000000007;

void solve() {

int n,k;
scanf("%d %d",&n,&k);

unsigned long long int r=1;

for(int i=0; i<k; i++) {
    r=(r*n)%mod;
}
printf("%lld\n",r);

}

int main()
{
    int t;
    scanf("%d",&t);

    for(int i=0; i<t; i++) {
        solve();
    }
    return 0;
}

/**
 * @Author: Yang Li
 * @Date:   2022-03-15 22:45:18
 * @Last Modified by:   Yang Li
 * @Last Modified time: 2022-03-15 22:57:48
 */
/*
n^k % 1000000007
*/
# include <stdio.h>

int main () {
    int t;
    scanf("%d", &t);
    while (t--) {
        long long n;
        int k;
        scanf("%lld %d", &n, &k);
        long long cnt = 1;
        for (int i = 0; i < k; i++) {
            cnt *= n;
            cnt %= 1000000007;
        }
        printf("%lld\n", cnt);
    }
    return 0;
}

#include <stdio.h>

const long long MOD = 1e9 + 7;

int main() {
  long long t, n, k, ans;
  scanf("%I64d", &t);
  while (t--) {
    scanf("%I64d%I64d", &n, &k);
    ans = 1; while (k--) ans = ans * n % MOD;
    printf("%I64d\n", ans);
  }
  return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long int ll;
typedef unsigned long long ull;
typedef long double lld;
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}
void swap(int *a, int *b) {
    int t = *a;
    *a = *b;
    *b = t;
}
typedef struct array {
    int first, second, third;
} point;
ll  min(ll  a, ll b) {
    return a < b ? a : b;
}
ll max(ll a, ll b) {
    return a > b ? a : b;
}
int cmpfunc (const void * a, const void * b) {
    return ( * (int*)a - * (int*)b );
}
int cmc(const void *a, const void *b) {
    return *(char *)b - *(char *)a;
}
int comp(const void* a, const void* b) {
    long long i = *(long long*)a;
    long long j = *(long long*)b;
    return (int)((i > j) - (i < j));
}
#define pr printf
#define sc scanf
#define re(i,a,b) for(int i=a;i<b;i++)
#define I 1e18
#define in32(x) scanf("%d", &x)
#define out32(x) printf("%d\n", x)
//qsort(a, n, sizeof(int), cmpfunc);
void test();
int main()
{
/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif*/
    int t;
    scanf("%d", &t);
    while (t--)
    {
        test();
    }
}
void test()
{

    ll n, k;
    sc("%lld %lld", &n, &k);
    ll res = 1, m = 1e9 + 7;
    while (k > 0)
    {
        if (k & 1)
        {
            res = (res * n % m) % m;
        }
        n = n % m * n % m;
        k = k >> 1;
    }
    printf("%lld\n", res);

}

#include<stdio.h>
#define ll long long
#define MOD 1000000007
int main(){
    int t;
    scanf("%d",&t);

    while(t--){

        int n,k;
        scanf("%d%d",&n,&k);

        ll ans = 1;
        for(int i = 0 ; i < k; i++){
            ans *= n;
            if(ans >= MOD){
                ans %= MOD;
            }
        }
        printf("%lld\n",ans);

    }

    return 0;
}

#include <stdio.h>
const int N=1e+9+7;

int main()
{
	long long int a,b,c,d;
	scanf("%lld",&a);
	while(a--) {
		d=1;
		scanf("%lld%lld",&b,&c);
		while(c--) d=(d*b)%N;
		printf("%lld\n",d);
	}
}

#include <stdio.h>
#define div 1000000007
int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        long long n,k,ans=1;
        scanf("%lld %lld",&n,&k);
        for(int i=0;i<k;i++){
            ans=ans*n%div;
        }
        printf("%lld\n",ans);
    }

    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long int ll;
ll p=1000000000+7;
int main()
{
    int t,i;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        ll n,k,ans=1,j;
        scanf("%lld%lld",&n,&k);
       for(j=1;j<=k;j++)
       {
           ans=(ans*n)%p;
       }
       printf("%lld\n",ans);
    }
    return 0;
}

#include <stdio.h>
void main(){
	long long  mod = 1000000007;
	int t;
	scanf("%d",&t);
	while (t--){
		long long  n,k;
		scanf("%lld %lld",&n,&k);
		long long ans = 1;
		for (int i=0;i<k;i++){
			ans = (ans*n)%mod;
		}
		printf("%lld\n",ans );

	}

}

#include<stdio.h>
#define f 1000000007
int main()
{
	int n;
	long long sum;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a,b;
		sum=1;
		scanf("%d %d",&a,&b);
		for(int j=1;j<=b;j++){
			sum*=a;
			sum%=f;
		}
		printf("%d\n",sum);
	}
	return 0;
}

#include <stdio.h>
int main()
{
        int no_of_test_cases;
        scanf("%d",&no_of_test_cases);
        long long int no_of_bits,k;
        int no_of_numbers;
        for(int i=0;i<no_of_test_cases;i++)
        {
          scanf("%lld",&no_of_bits);
          scanf("%d",&no_of_numbers);
          //printf("%lld %d\n",no_of_bits,no_of_numbers);
          k = no_of_bits;
          for(int j=0;j<no_of_numbers-1;j++)
          {
              no_of_bits *= k;
              //printf("%ld\n",no_of_bits);
              if(no_of_bits > 1000000007)
              {
                  no_of_bits = (no_of_bits%1000000007);
              }
          }
          printf("%lld\n",no_of_bits);
        }
}

#include <stdio.h>

int main()
{
    int n,k,i,j,test;
    long long int c;
    scanf("%d",&test);
    for(i=1;i<=test;i++)
    {
        c=1;
        scanf("%d",&n);
        scanf("%d",&k);
        for(j=1;j<=k;j++)
        {
            c=(c*n)%(1000000000+7);
        }
        printf("%lld\n",c);
    }
    return 0;
}

#include<stdio.h>
const long long int max=1e9+7;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int n,k;
        scanf("%lld%lld",&n,&k);
        long long int sum=1;
        for(int i=0; i<k; i++)
        {
            sum=(sum*n)%max;
        }
        printf("%lld\n",sum);
    }
}

#include <stdio.h>
#define forin(i, n) for (i = 0; i < n; i++)
#define lli long long int
#define printSp(i, a, n) forin(i, n) printf('%d ', a[i]);
#define printLn(i, a, n) forin(i, n) printf('%d\n', a[i]);
#define fis(n) fast_int_scan(n)
#define fls(n) fast_long_scan(n)
#define flli(n) fast_lli_scan(n)
#define scanIA(i, a, n) forin(i, n) fis(a + i);
#define scanLA(i, a, n) forin(i, n) fls(a + i);
#define scanLLIA(i, a, n) forin(i, n) flli(a + i);

void fast_int_scan(int *number)
{
    //variable to indicate sign of input number
    int negative = 0;
    register int c;

    *number = 0;

    // extract current character from buffer
    c = getchar();
    if (c == '-')
    {
        // number is negative
        negative = 1;

        // extract the next character from the buffer
        c = getchar();
    }

    // Keep on extracting characters if they are integers
    // i.e ASCII Value lies from '0'(48) to '9' (57)
    for (; (c > 47 && c < 58); c = getchar())
        (*number) = (*number) * 10 + c - 48;

    // if scanned input has a negative sign, negate the value
    if (negative)
        (*number) *= -1;
}

void fast_lli_scan(lli *number)
{
    //variable to indicate sign of input number
    int negative = 0;
    register int c;

    *number = 0;

    // extract current character from buffer
    c = getchar();
    if (c == '-')
    {
        // number is negative
        negative = 1;

        // extract the next character from the buffer
        c = getchar();
    }

    // Keep on extracting characters if they are integers
    // i.e ASCII Value lies from '0'(48) to '9' (57)
    for (; (c > 47 && c < 58); c = getchar())
        (*number) = (*number) * 10 + c - 48;

    // if scanned input has a negative sign, negate the value
    if (negative)
        (*number) *= -1;
}

int main(void)
{
	int T;
	fast_int_scan(&T);
	while (T--)
	{
		lli n, k, i, sum = 1;
		fast_lli_scan(&n);
        fast_lli_scan(&k);
		for(i=1; i<=k; i++)
		{
			sum *= n;
			sum %= 1000000007;
		}

		printf("%lld\n", sum);
	}
	return 0;
}

#include <stdio.h>

int main(void) {
	unsigned t, k;
	unsigned long long n, i;

	scanf("%u", &t);

	while (t--) {
		scanf("%llu %u", &n, &k);

		i = 1;

		while (k--) {
			i *= n;
			i %= 1000000007;
		}

		printf("%llu\n", i);
	}
}

//每一个元素最多有k位 高于k位不考虑
//要使数组元素尽可能大且所有元素按位与为0
//即所有元素的2进制每一位都有且仅有一个为0
//每一位有n种可能，结果为n^k
#include<stdio.h>
const int mod=1e9+7;
int duqi(int n,int k){
	long long p=n,sum=1;
	while(k!=0){
	p=p%mod;
	if(k%2==0){
		k/=2;p*=p;
	}
	else{
		k/=2;sum=sum*p%mod;p*=p;
	}
	}
	return sum;
}
int main()
{
	int k,n,t;
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		printf("%d\n",duqi(n,k));
	}
}

#include <stdio.h>
#include<math.h>

int n,k;
const int MOD=1e9+7;

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d",&n,&k);
        long long ans=1;
        for(int i=0;i<k;i++) ans=(ans*n)%MOD;
        printf("%lld\n",ans);
    }
}

#include<stdio.h>
const long long mod=1e9+7;
long long f(long long n,long long k){
	long long sum=1,i;
	for(i=1;i<=k;i++){
		sum=sum%mod*n%mod;
	}
	return sum;
}
int main(void){
	long long t;
	long long n,k;
	long long ans;
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld",&n,&k);
		ans=f(n,k)%mod;
		printf("%lld\n",ans);
	}
	return 0;
}

#include<stdio.h>
#define ll long long
#define rep(a,b) for(ll i=a;i<b;i++)
#define N 1000000007
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		ll a,b;
		scanf("%lld %lld",&a,&b);
		ll ta=a;
		rep(1,b)
		{
			a*=ta;
			a%=N;
		}
		printf("%lld\n",a);

	}
}

#include <stdio.h>
#define MOD 1000000007
#define ll long long

int main(void)
{
    int t;
    scanf("%d", &t);

    while (t--) {

        int n, k;
        scanf("%d%d", &n, &k);

        ll result = n;
        for (int i = 1; i < k; i++) {
            result = result * n % MOD;
        }
        printf("%lld\n", result);
    }
    return 0;
}

#include<stdio.h>
#include<stdlib.h>

int main(void)
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		long long int n,k,i,sum=1;
		scanf("%lld %lld",&n,&k);
		for(i=1;i<=k;i++)
		{
			sum*=n;
			sum=sum%(1000000000+7);
		}
		printf("%lld\n",sum);
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t,n,k,i,j;long long s;
    scanf ("%d",&t);
    for (i=0;i<t;i++)
    {
        s=1;
        scanf ("%d %d",&n,&k);
        for (j=0;j<k;j++)
        {
            s=(s*n)%1000000007;
        }
        printf ("%lld\n",s);
    }
return 0;
}

#include<stdio.h>
#define ll long long
const int mod=1e9+7;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n,k;
		scanf("%d%d",&n,&k);
		ll ans=1;
		for(int i=1;i<=k;i++)
		{
			ans=(ans*n)%mod;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD (1000000007)

int main(void)
{
	int TC, tcase, n, k;
	scanf("%d", &TC);
	for (tcase = 0; tcase < TC; tcase++)
	{
		scanf("%d %d", &n, &k);
		long long p = 1;
		for (int i = 0; i < k; ++i)
		{
			p = (p * n) % MOD;
		}
		printf("%lld\n", p);
	}
	return 0;
}

#include <stdio.h>

long long K = 1000000000+7;

int main() {
    long long t, n, k, i, sol, j;
    scanf("%lld", &t);

    for( i = 0; i < t; i++ ){
        scanf("%lld", &n);
        scanf("%lld", &k);
        sol = 1;
        for( j = 0; j < k; j++ )
            sol = (sol*n)%K;
        printf("%lld\n", sol);
    }
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
typedef long long (ll);
#define A 10005
#define M 1000000007
ll z[A],p[A],q[A],r[A];
char s[A];

void merge(ll arr[],ll l,ll m,ll r)
{
    ll i,j,k,n1,n2;
    n1=m-l+1;
    n2=r-m;
    ll L[n1],R[n2];
    for(i=0;i<n1;i++)
		L[i]=arr[l+i];
    for(j=0;j<n2;j++)
		R[j]=arr[m+1+j];
    i=j=0;
	k=l;
    while(i<n1&&j<n2)
    {
        if(L[i]<R[j])
            arr[k++]=L[i++];
        else
            arr[k++]=R[j++];
    }
    while(i<n1)
        arr[k++]=L[i++];
    while(j<n2)
        arr[k++]=R[j++];
}
void sort(ll arr[],ll l,ll r)
{
    if(l<r)
    {
        ll m=l+(r-l)/2;
        sort(arr,l,m);
		sort(arr,m+1,r);
		merge(arr,l,m,r);
    }
}
int main()
{
	ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;m=M;
	scanf("%lli",&a);
	for(b=1;b<=a;b++)
	{
		scanf("%lli%lli",&c,&d);
		for(e=1;d;d--)
		{
			e*=c;
			e%=m;
		}
		printf("%lli\n",e);
	}
	return 0;
}

#include <stdio.h>
long long BP(long long a, long long b, long long p)
{
	long long r = 1;
	while (b)
	{
		if (b & 1)
		{
			r *= a;
			r %= p;
		}
		a *= a;
		a %= p;
		b >>= 1;
	}
	return r;
}
int main()
{
	int T;
	long long n, k;
	long long R;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%I64d %I64d", &n, &k);
		R = BP(n, k, 1000000007);
		printf("%I64d\n", R);
	}
	return 0;
}

#include<stdio.h>

int t;
int n,k;
long long mod;

long long p(int nn,int kk)
{
	long long mm,tt;
	mm=1;
	tt=nn;
	while(kk){
		if(kk%2){
			mm=mm*tt%mod;
		}
		tt=tt*tt%mod;
		kk/=2;
	}
	return mm;
}

int main()
{
	mod=1000000007;
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		printf("%lld\n",p(n,k));
	}
	return 0;
}

#include<stdio.h>
int main(){
 int t;
 scanf("%d",&t);

 while(t--){
  int n,k;
  int max=1e9+7;
  scanf("%d%d",&n,&k);
  long long int ans=1;
  for(int i=1;i<=n;i++){
   ans=(ans*i)%max;
  }
  printf("%lld",ans);
 }
 return 0;
}

#include <stdio.h>
int a[100000];
int main()
{
 unsigned int t,n,k;
 scanf("%d",&t);
 while(t--)
 {
     scanf("%d%d",&n,&k);
     int d,l=0,new=0,kk=0;
    while(k--){
         l=0,new=0;
     while(n)
     {
        d=n%10;
        a[l]=d+1;
        l++;
        n/=10;
     }
     kk=0;
    while(l--)
    {
       if(a[l]==10)
       {  new=new*10+1;
          new=new*10+0;kk=kk+2;
          continue; }
        new=new*10+a[l]; kk++;   }
    n=new;
    }

    printf("\n%d",kk);
 }

    return 0;
}

#include <stdio.h>

int main()
{
 unsigned int t,k;
 unsigned long long int n,i;
 scanf("%u",&t);
 while(t--)
 {
     scanf("%llu%u",&n,&k);
     i=1;
     while(k--)
     {
         i=i*n%1000000007;
     }
printf("%\nllu",i);
 }

    return 0;
}

#include <stdio.h>

int main()
{
 unsigned int t,k;
 unsigned long long int n,i;
 scanf("%u",&t);
 while(t--)
 {
     scanf("%llu%u",&n,&k);
     i=1;
     while(k--)
     {
         i=i*n%1000000007;
     }
printf("%llu",i);
 }

    return 0;
}

#include <stdio.h>

enum{ MAX = 1000000007 };

int main()
{
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; ++i) {
        int n, k;
        scanf("%d%d", &n, &k);
        unsigned long res = 1;
        for(int j = 0; j < k; ++j) {
            res *= n;
            res %= MAX;
        }
        printf("%lu\n", res);
    }
}

#include <stdio.h>

enum{ MAX = 1000000007 };

int main()
{
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; ++i) {
        int n, k;
        scanf("%d%d", &n, &k);
        long res = 1;
        for(int j = 0; j < k; ++j) {
            res *= n;
            res %= MAX;
        }
        printf("%ld\n", res);
    }
}

#include<stdio.h>
int main(){
  int t;
  scanf("%d",&t);
  while(t--){
    int n,k;
    scanf("%d %d",&n,&k);
    long long int ans = 0;
    for(int i=1; i<=k; i++){
      ans=ans*n;
      ans=ans%1000000007;
    }
    printf("%lld\n",ans);
  }
  return 0;
}

#include<stdio.h>
int main()
{
    int t;
    scanf("%d", &t);
    while(t--)
    {
        int n, k, c=1;
        scanf("%d %d", &n, &k);
        while(k--)
            c=c*n;
        printf("%d", c%1000000007);
    }
}

#include<stdio.h>
int main() {
	int t; scanf("%d", &t);
	int mod = 1e9 + 7;
	while (t--) {
		int n, k; scanf("%d%d", &n, &k);
		int ans = 1;
		for (int i = 0; i < k; i++) {
			ans *= n;
			ans %= mod;
		}
		printf("%d\n", ans);
	}
}

#include<stdio.h>
int a=1e9+7;
int main(){
	int t;
	long long int ans,n,k;
	scanf("%d",&t);
	while(t--){
		ans=1;
		scanf("%d %d",&n,&k);
		n=n%a;
		while(k>0){
			if(k%2==1){
				ans=(ans*n)%a;
			}
			k=k/2;
			n=(n*n)%a;

		}
		printf("%d\n",ans);
	}
	return 0;
}

#include <stdio.h>

#define M 1000000007

int min(int a, int b) { return a < b ? a : b; }

int main()
{
     int x,y,z,i,j,k,a,b,c,n,m,t;
     long long res;

     scanf("%d",&t);
     while(t--)
     {
           res = 1;
           scanf("%d %d",&n,&k);
           k = min(n, k);
           for(x = 0; x < k; x++)
               res = (res * n) % M;

           printf("%lld\n",res);
     }
     return 0;
}

#include<stdio.h>

int main()
{
    long long int sum=1,n,k;
    int t;
    scanf("%d",&t);
    for(int i=0;i<t;i++)
    {
        sum=1;
        scanf("%d %d",&n,&k);
        for(int j=0;j<k;j++)
            sum=(sum*n)%1000000007;
        printf("%lld\n",sum);
    }
    return 0;
}