#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, p = 1000000007;
int A[10], B[10];
int main() {
  cin >> n;
  A[0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= 3; j++)
      for (k = 0; k <= 3; k++) {
        if (j == k) continue;
        B[j] = (B[j] + A[k]) % p;
      }
    for (j = 0; j <= 3; j++) {
      A[j] = B[j];
      B[j] = 0;
    }
  }
  cout << A[0] << endl;
  return 0;
}
