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