#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, pl, cl;
long long int D[2][5];
int main() {
  cin >> n;
  D[0][1] = 1;
  for (i = 1; i <= n; ++i) {
    cl = i % 2, pl = (cl + 1) % 2;
    for (j = 1; j <= 4; ++j) {
      D[cl][j] = 0;
      for (k = 1; k <= 4; ++k) {
        if (k == j) continue;
        D[cl][j] += D[pl][k], D[cl][j] %= 1000000007;
      }
    }
  }
  cout << D[n % 2][1] << '\n';
  return 0;
}
