#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  vector<long long> dp = {1, 1, 1, 0};
  for (long long i = 0; i < n - 1; i++) {
    vector<long long> nw = {
        (dp[1] + dp[2] + dp[3]) % MOD, (dp[0] + dp[2] + dp[3]) % MOD,
        (dp[0] + dp[1] + dp[3]) % MOD, (dp[0] + dp[1] + dp[2]) % MOD};
    dp = nw;
  }
  cout << dp[3] << endl;
  return 0;
}
