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