#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int x = 0;
  for (int i = 2; i <= n; ++i) {
    if (i & 1)
      x = (x * 3 - 3) % 1000000007;
    else
      x = (x * 3 + 3) % 1000000007;
  }
  cout << x << endl;
  return 0;
}
