#include <bits/stdc++.h>
using namespace std;
long long int mod = pow(10, 9) + 7;
int main() {
  int n;
  cin >> n;
  vector<long long int> v(n + 1, 0);
  long long int q = 0;
  v[1] = 1;
  for (int i = 2; i <= n; i++) {
    long long int p = q;
    q = (v[i - 1] % mod * 3 + mod) % mod;
    v[i] = (p % mod + (v[i - 1] * 2) % mod + mod) % mod;
  }
  cout << q % mod << endl;
}
