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