#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long cd = 1, cabc = 0;
  for (long long i = 0; i < n; i++) {
    long long temp = cd;
    cd = (cabc * 3) % 1000000007;
    cabc = cabc * 2 + temp;
    cabc %= 1000000007;
  }
  cout << cd;
}
