#include <bits/stdc++.h>
using namespace std;
long long const mod = 1e9 + 7;
long long pw = 1, ans, n;
int main() {
  cin >> n;
  while (--n) ans = ((pw = (3 * pw) % mod) - ans + mod) % mod;
  return cout << ans, 0;
}
