#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int d = 1;
  int num = 0;
  int mod = 1000000007;
  for (int i = 1; i <= n; i++) {
    int mi = (3LL * num) % mod;
    int ni = (d + 2LL * num) % mod;
    d = mi;
    num = ni;
  }
  cout << d << endl;
  return 0;
}
