#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000000, mod = 1000000007;
long long int n;
long long int dp[maxn];
int main() {
  cin >> n;
  long long int z = 0;
  dp[1] = 0;
  dp[2] = 3;
  dp[3] = 6;
  for (int i = 4; i <= n; i++) {
    if (i % 2 == 0)
      dp[i] = ((dp[i - 1] * 3) + 3) % mod;
    else
      dp[i] = ((dp[i - 1] * 3) - 3) % mod;
  }
  cout << dp[n];
}
