#include <bits/stdc++.h>
using namespace std;
long long dp1[10000010], dp2[10000010];
const long long mod = 1e9 + 7;
int main(void) {
  int N, i;
  cin >> N;
  dp1[0] = 1;
  for (int i = 0; i <= N; ++i) {
    dp1[i + 1] = dp2[i];
    dp2[i + 1] = (dp1[i] * 3 + dp2[i] * 2) % mod;
  }
  cout << dp1[N] << "\n";
  return 0;
}
