#include
using namespace std;
typedef long long ll;
const int N=1000,mod=1000000007;
ll a[N+10],b[N+10];
int main()
{
int n;
scanf("%d",&n);
b[1]=1;
for(int i=2;i<=n;i++) b[i]=(b[i-1]*2)%mod;
a[1]=1,a[2]=6;
for(int i=3;i<=n;i++) a[i]=(b[i]+(2*a[i-1])%mod+(4*a[i-2])%mod)%mod;
if(n==1){printf("2\n");return 0;}
ll ans=4*a[n]%mod;
for(int i=2;i<=n-1;i++)
{
ans+=((8*b[i-1]*a[n-i])%mod+(8*b[n-i]*a[i-1])%mod)%mod;
ans%=mod;
}
printf("%lld\n",ans);
return 0;
}