#include <bits/stdc++.h>
using namespace std;
long long int D[10000001];
long long int A[10000001];
int main(void) {
  D[0] = 1;
  A[1] = 1;
  A[0] = 0;
  int n;
  cin >> n;
  long long int mod = 1000000007;
  for (int i = 1; i <= n; i++) {
    D[i] = ((A[i - 1] + A[i - 1]) % mod + A[i - 1]) % mod;
    A[i] = ((2 * A[i - 1]) % mod + D[i - 1]) % mod;
  }
  cout << D[n];
  return 0;
}
