#include <bits/stdc++.h>
using namespace std;
long long n, A, B, C = 1;
const long long E = 1e9 + 7;
int main() {
  cin >> n;
  if (n <= 1) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = 2; i < n; i++) {
    A = B;
    B = C;
    C = 2 * B + 3 * A;
    C %= E;
  }
  long long ans = (3 * C) % E;
  cout << ans << endl;
  return 0;
}
