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