#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000000 + 7;
const int N = 10000001;
long long dp[N];
int main() {
  dp[1] = 0;
  dp[2] = 3;
  for (int i = 3; i < N; i++) dp[i] = (dp[i - 2] * 3 + dp[i - 1] * 2) % mod;
  int n;
  while (scanf("%d", &n) != EOF) printf("%lld\n", dp[n]);
  return 0;
}
