#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 5, M = 7e4 + 7, mod = 1e9 + 7;
const double ESP = 1e-8;
int dp[2][4];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 4; j++) {
      dp[i & 1][j] = 0;
      for (int k = 0; k < 4; k++) {
        if (k != j) dp[i & 1][j] += dp[(i - 1) & 1][k];
        if (dp[i & 1][j] >= mod) dp[i & 1][j] -= mod;
      }
    }
  }
  cout << dp[n & 1][0];
}
