#include <bits/stdc++.h>
using namespace std;
int arr[100000 + 5];
int ar[100000 + 5];
int main() {
  long long a = 1, b = 0, c;
  long long n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    c = b;
    b = (2 * b + 3 * a) % 1000000007;
    a = c;
  }
  cout << b;
}
