#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <cmath>
#include <vector>
#define max_ 200010
#define inf 0x3f3f3f3f
#define mod 1000000007
#define ll long long
using namespace std;
ll n;
int fpow(ll n)
{
ll ans=1;
ll tmp=2;
while(n!=0)
{
if(n&1)
ans=(ans*tmp)%mod;
n/=2;
tmp=(tmp*tmp)%mod;
}
return ans%mod;
}
int main(int argc, char const *argv[]) {
cin>>n;
if(n==0)
{
printf("1\n" );
return 0;
}
cout<<(fpow(n-1)+fpow(2*n-1))%mod<<endl;
return 0;
}