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