Sample Input
2
Sample Output
2
Hint
1. For N = 2, S(1) = S(2) = 1. 2. The input file consists of multiple test cases.
#include<stdio.h>
#include<string.h>
typedef long long ll;
const int mod=1e9+7;
const int maxn=1e5+5;
char str[maxn];
ll q_pow(ll a,ll b)
{
ll ans=1;
while(b)
{
if(b&1)
{
ans=ans*a%mod;
}
a=a*a%mod;
b=b>>1;
}
return ans;
}
int main()
{
while(scanf("%s",str)!=EOF)
{
ll s=0;
for(int i=0;i<strlen(str);i++)
{
s=(s*10+str[i]-'0')%(mod-1);
}
ll rel;
rel=q_pow(2,s-1);
printf("%lld\n",rel);
}
return 0;
}