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