#include <bits/stdc++.h>
using namespace std;
int dp[4][10000007];
int main() {
  dp[0][0] = 1;
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 4; ++j)
      for (int k = 0; k < 4; ++k)
        if (j != k) {
          int &ans = dp[j][i];
          ans += dp[k][i - 1];
          if (ans >= 1000000007) ans -= 1000000007;
        }
  cout << dp[0][n] << endl;
}
