#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define nl cout<<endl
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll,ll>
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define ff first
#define ss second
#define hell 1000000007
#define test4(x,y,z,a) cout<<"x is "<<x<<" y is "<<y<<" z is "<<z<<" a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<" y is "<<y<<" z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<" y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009
ll power(ll a,ll b,ll m)
{
ll ans=1;
while(b)
{
if(b&1)
ans=(ans*a)%m;
b/=2;
a=(a*a)%m;
}
return ans;
}
ll n;
ll dp[N][8];
ll go(ll ind,ll mask)
{
if(ind==(n+1))
return mask==0;
if(dp[ind][mask]!=-1)
return dp[ind][mask];
ll ans=0;
rep(i,0,6)
{
ans+=go(ind+1,mask^i);
ans%=hell;
}
return dp[ind][mask]=ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n;
memset(dp,-1,sizeof(dp));
cout<<go(1,0)<<endl;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgaW50IGxsOwp0eXBlZGVmIGxvbmcgZG91YmxlIGxkOwojZGVmaW5lIHJlcChpLGEsYikgIGZvcihsbCBpPWE7aTxiO2krKykKI2RlZmluZSBubCBjb3V0PDxlbmRsCgojZGVmaW5lIHBpaSBwYWlyPGxsLGxsPgojZGVmaW5lIHZpICB2ZWN0b3I8bGw+CiNkZWZpbmUgdmlpIHZlY3RvcjxwaWk+CiNkZWZpbmUgbWkgIG1hcDxsbCxsbD4KI2RlZmluZSBhbGwoYSkgIChhKS5iZWdpbigpLChhKS5lbmQoKQ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