#include <bits/stdc++.h>
using namespace std;
const long long mods = 1e9 + 7;
long long f[11347845];
signed main() {
  long long n;
  cin >> n;
  f[1] = 0;
  long long bas = 3;
  for (register long long i = 2; i <= n; i++) {
    f[i] = bas - f[i - 1];
    f[i] = (f[i] % mods + mods) % mods;
    bas *= 3LL;
    bas %= mods;
  }
  cout << f[n];
  return 0;
}
