#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e7 + 5;
int dp[maxn][5], n;
int main() {
  while (cin >> n) {
    memset(dp, 0, sizeof(dp));
    dp[0][1] = 1;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= 4; j++)
        for (int k = 1; k <= 4; k++)
          if (j != k) dp[i][j] = (dp[i][j] + dp[i - 1][k]) % mod;
    cout << dp[n][1] << endl;
  }
  return 0;
}
