#include <bits/stdc++.h>
int main() {
  int n, i;
  unsigned int a = 0, b = 0, c = 0, d = 1;
  unsigned int oa, ob, oc, od;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    oa = a, ob = b, oc = c, od = d;
    a = b = c = d = 0;
    a = ob + oc + od;
    while (a >= 1000000007) a -= 1000000007;
    b = oa + oc + od;
    while (b >= 1000000007) b -= 1000000007;
    c = oa + ob + od;
    while (c >= 1000000007) c -= 1000000007;
    d = oa + ob + oc;
    while (d >= 1000000007) d -= 1000000007;
  }
  printf("%u\n", d);
  return 0;
}
