#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e7 + 5;
int n;
int dp[N][4];
void solve() {
  long long n;
  cin >> n;
  dp[0][0] = 1;
  dp[0][1] = dp[0][2] = dp[0][3] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = ((dp[i - 1][1] + dp[i - 1][2]) % mod + dp[i - 1][3]) % mod;
    dp[i][1] = ((dp[i - 1][0] + dp[i - 1][2]) % mod + dp[i - 1][3]) % mod;
    dp[i][2] = ((dp[i - 1][1] + dp[i - 1][0]) % mod + dp[i - 1][3]) % mod;
    dp[i][3] = ((dp[i - 1][1] + dp[i - 1][2]) % mod + dp[i - 1][0]) % mod;
  }
  cout << dp[n][0];
}
int main() {
  int test = 1;
  for (int i = 1; i <= test; i++) {
    solve();
  }
}
