#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int MOD = 1000000007;
void solve() {
  int n;
  cin >> n;
  vector<vector<int>> dp(4, vector<int>(n + 1, 0));
  dp[3][0] = 1;
  for (int i = 1; i < n + 1; i++)
    for (int j = 0; j < 4; j++)
      for (int k = 0; k < 4; k++)
        if (k != j) dp[j][i] = (dp[j][i] + dp[k][i - 1]) % MOD;
  cout << dp[3][n] << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
