#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, ans = 0, m = 1e9 + 7;
  cin >> n;
  long long a = 1, b = 0, c = 0, d = 0, at, dt, ct, bt;
  for (long long i = 1; i <= n; i++) {
    at = (b + (c + d) % m) % m;
    dt = (a + (b + c) % m) % m;
    ct = (d + (a + b) % m) % m;
    bt = (c + (d + a) % m) % m;
    a = at;
    b = bt;
    c = ct;
    d = dt;
  }
  cout << a;
  return 0;
}
