#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int dp[10000000 + 7][5];
int main() {
  dp[0][1] = 1;
  int step;
  cin >> step;
  for (int i = 1; i <= step; i++) {
    for (int j = 1; j <= 4; j++) {
      for (int k = 1; k <= 4; k++) {
        if (j == k) continue;
        dp[i][j] = (dp[i][j] + dp[i - 1][k]) % mod;
      }
    }
  }
  cout << dp[step][1] << endl;
  return 0;
}
