#include <bits/stdc++.h>
using namespace std;
long long const MAXN = 2e5 + 10;
long long const mod = 1e9 + 7;
long long n, m, T;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  long long f = 0, g = 1;
  for (long long i = 2; i <= n; i++) {
    long long t = f;
    f = 3 * g % mod;
    g = (t + 2 * g) % mod;
  }
  cout << f;
  return 0;
}
