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