#include <bits/stdc++.h>
using namespace std;
const long long m = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  long long abc[n + 1];
  long long d[n + 1];
  abc[0] = 0;
  d[0] = 1;
  for (int i = 1; i <= n; ++i) {
    d[i] = (3 * (abc[i - 1] % m)) % m;
    abc[i] = (d[i - 1] % m + 2 * (abc[i - 1] % m) % m) % m;
  }
  cout << d[n] << "\n";
}
