#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1e7 + 10;
const double eps = 1e-4;
const double pi = acos(-1);
long long gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
long long f[N];
int main() {
  long long n;
  f[1] = 0;
  f[2] = 3;
  scanf("%lld", &n);
  for (int i = 3; i <= n; i++) {
    f[i] = 2 * f[i - 1] + 3 * f[i - 2];
    f[i] %= mod;
  }
  printf("%lld\n", f[n]);
  return 0;
}
