#include <bits/stdc++.h>
using namespace std;
int n, l, r, a, i;
const int mod = 1000000007;
const int N = 1e7 + 2;
int dp[4][N];
int main() {
  cin >> n;
  dp[3][0] = 1;
  dp[2][0] = 0;
  dp[0][0] = 0;
  dp[1][0] = 0;
  for (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[3][n];
  return 0;
}
