#include <bits/stdc++.h>
using namespace std;
int n;
long long MOD = 1e9 + 7;
int main() {
  while (scanf("%d", &n) == 1) {
    if (n == 1) {
      cout << 0 << endl;
      continue;
    }
    bool temp = 1;
    long long ans = 3;
    for (int i = int(2); i < int(n); i++) {
      ans *= 3;
      if (temp == 1)
        ans -= 3;
      else
        ans += 3;
      ans %= MOD;
      ans = (((ans % MOD) + MOD) % MOD);
      temp = !temp;
    }
    cout << ans << endl;
  }
  return 0;
}
