#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << "0";
    return 0;
  }
  if (n == 2) {
    cout << "3";
    return 0;
  }
  if (n == 3) {
    cout << "6";
    return 0;
  }
  long long m1 = 3, m2 = 6;
  long long tmp;
  for (int i = 4; i <= n; i++) {
    tmp = 3 * m1 + 2 * m2;
    tmp %= 1000000007;
    m1 = m2;
    m2 = tmp;
  }
  cout << tmp;
}
