#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
#define LL __int64
const LL mod=1e9+7;
LL pow_mod(LL a,LL b)
{
LL s=1;
while(b)
{
if(b&1)
s=(s*a)%mod;
a=(a*a)%mod;
b=b>>1;
}
return s;
}
char a[100001];
int main()
{
LL n,i,j,k,s=1;
/*for(i=1;;i++)
{
s=(s*2)%mod;
if(s==1)
break;
}
cout<<i<<endl;*/
while(cin>>a)
{
n=strlen(a);
LL i,j,k;
LL s=0;
LL m=500000003;
for(i=0;i<n;i++)
{
s=s*10+a[i]-'0';
if(s>=m)
s=s%m;
}
s=(s-1+m)%m;
LL t;
t=pow_mod(2,s);
cout<<t<<endl;
}
return 0;
}