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