#include <bits/stdc++.h>
using namespace std;
void solve() {
  int N;
  cin >> N;
  long long int dp_D = 1, dp = 0, dp_temp;
  for (int i = 0; i < N; i++) {
    dp_temp = dp_D;
    dp_D = 3 * dp;
    dp = dp * 2 + dp_temp;
    dp %= 1000000007;
    dp_D %= 1000000007;
  }
  cout << dp_D << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
