#include <bits/stdc++.h>
using namespace std;
#define enter cout<<"\n"
#define int long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MOD 1000000007
#define MAXM 1000000
void fastIO()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void display(vector<vector<char>> &v, int n, int m)
{
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++) {
cout<<v[i][j];
} enter;
}
}
int n;
// vector<vector<int>> adj;
// vector<int>depth, size, inc;
// int dfs(int c, int p)
// {
// depth[c] = depth[p] + 1; size[c] = 1;
// for(int i=0; i<adj[c].size(); i++) {
// if(adj[c][i] == p) continue;
// size[c] += dfs(adj[c][i], c);
// }
// inc[c] = size[c] - depth[c]; return size[c];
// }
vector<int> dpLast;
void solve()
{
fastIO();
cin>>n;
dpLast = vector<int>(2, 0);
dpLast[1] = 1;
vector<int> dpNew(2,0);
for(int i=1; i<=n; i++) {
dpNew[0] = (2*dpLast[0] + dpLast[1])%MOD;
dpNew[1] = (3*dpLast[0])%MOD;
dpLast = dpNew;
}
cout<<dpLast[1]; enter;
}
int32_t main()
{
solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKI2RlZmluZSBlbnRlciBjb3V0PDwiXG4iCiNkZWZpbmUgaW50ICBsb25nIGxvbmcgIAojZGVmaW5lIHZpIHZlY3RvcjxpbnQ+CiNkZWZpbmUgdmwgdmVjdG9yPGxsPgojZGVmaW5lIHBpaSBwYWlyPGludCxpbnQ+CiNkZWZpbmUgcGxsIHBhaXI8bGwsbGw+CiNkZWZpbmUgTU9EIDEwMDAwMDAwMDcKI2RlZmluZSBNQVhNIDEwMDAwMDAKIAp2b2lkIGZhc3RJTygpCnsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKfQogCiAKdm9pZCBkaXNwbGF5KHZlY3Rvcjx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