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