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