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