#include <bits/stdc++.h>
using namespace std;
long long dp1[10000010], dp2[10000010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if (i == 1)
      dp2[i] = 1;
    else {
      long long k = 1000000007;
      dp1[i] = (3 * dp2[i - 1]) % k;
      dp2[i] = (dp1[i - 1] + 2 * dp2[i - 1]) % k;
    }
  }
  cout << dp1[n] << endl;
}
