#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"a=b=c=d=e=f=0;g=1;exec('a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,(g*4-b-c-d-a*3)%(10**9+7);'*int(input()));print(g)\n"
"\"";
  system(s);
  return 0;
}            