#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, c;
  cin >> n;
  long long k = 0;
  for (long long i = 0; i < n - 1; ++i) {
    if (i % 2 == 0) {
      c = 3;
    } else {
      c = -3;
    }
    k = (k * 3 + c) % 1000000007;
  }
  cout << k;
}
