#include <bits/stdc++.h>
using namespace std;
int memo[4][10000011];
int path;
int main() {
  scanf("%d", &path);
  memo[0][path] = 1;
  for (int i = path - 1; i >= 0; i--) {
    for (int j = 0; j < 4; ++j)
      for (int k = 0; k < 4; ++k) {
        if (j != k) {
          memo[j][i] = (memo[j][i] + (memo[k][i + 1])) % 1000000007;
        }
      }
  }
  printf("%d\n", memo[0][0]);
  return 0;
}
