#include <bits/stdc++.h>
using namespace std;
int main() {
  int i;
  long long int d = 1;
  long long int e = 0;
  cin >> i;
  for (int j = 1; j <= i; j++) {
    int nd = (e * 3LL) % 1000000007;
    int ne = (d + e * 2LL) % 1000000007;
    e = ne;
    d = nd;
  }
  cout << d;
  return 0;
}
