#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long ap, bp, cp, dp, a, b, c, d;
  ap = bp = cp = a = b = c = 1;
  dp = d = 0;
  for (long long i = 1; i < n; ++i) {
    ap = a;
    bp = b;
    cp = c;
    dp = d;
    a = (bp + cp + dp) % 1000000007;
    b = (ap + cp + dp) % 1000000007;
    c = (ap + bp + dp) % 1000000007;
    d = (ap + bp + cp) % 1000000007;
  }
  cout << d;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
