#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long dp[2][4], sum;
  dp[0][0] = 0;
  dp[0][1] = dp[0][2] = dp[0][3] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      sum = 0;
      for (int k = 0; k < 4; k++) {
        if (j == k) continue;
        sum += dp[0][k];
        sum %= 1000000007;
      }
      dp[1][j] = sum;
    }
    for (int j = 0; j < 4; j++) dp[0][j] = dp[1][j];
  }
  cout << dp[0][0] % 1000000007;
  return 0;
}
