#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int zD = 1;
  int zABC = 0;
  for (int i = 1; i <= n; i++) {
    int nzD = zABC * 3LL % 1000000007;
    int nzABC = (zABC * 2LL + zD) % 1000000007;
    zD = nzD;
    zABC = nzABC;
  }
  cout << zD;
  return 0;
}
