打表发现是2^n-1,但是n很大,借助费马小定理
最后还要除以2,因为是n-1次方,乘以逆元,防止除2出现各种问题(2*逆元=1000000008)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include<stdio.h>
#include<string.h>
#define MAX 100000
using namespace std;
const long long mod=1e9+7;
char num[100005];
long long quick(long long a,long long b)
{
long long ret=1;
for(;b;b=b>>1,a=a*a%mod)
if(b&1)
ret=ret*a%mod;
return ret;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
getchar();
long long ans = 0;
scanf("%s", num);
int len = strlen(num);
for(int i = 0; i < len; ++i)
{
ans = ans*10 + (num[i]-'0');
ans %= (mod-1);
}
printf("%lld\n",quick(2,ans)*500000004%mod);
}
return 0;
}