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