#include <bits/stdc++.h>
long long n, f, g = 1;
int main() {
  scanf("%lld", &n);
  for (int i = 2; i <= n; ++i) {
    long long tmp = f;
    f = 3 * g % 1000000007, g = (tmp + 2 * g) % 1000000007;
  }
  printf("%lld", f);
}
