#include <bits/stdc++.h>
using namespace std;
int n;
long long int cvp = 3;
int main() {
  scanf("%d", &n);
  for (int i = 3; i <= n; i++) {
    cvp = cvp * 3;
    if (i % 2 == 1)
      cvp -= 3;
    else
      cvp += 3;
    cvp = cvp % (long long int)1000000007;
  }
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  printf("%lld\n", cvp);
}
