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