#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int ans[10000005][2];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  if (n == 1) {
    cout << "0";
    return 0;
  }
  if (n == 2) {
    cout << 3;
    return 0;
  }
  ans[2][0] = 3;
  ans[2][1] = 2;
  for (long long int i = 3; i < n + 1; i++) {
    for (long long int j = 0; j < 2; j++) {
      ans[i][j] = 0;
      if (j == 0) {
        ans[i][j] = ((ans[i - 1][1]) * 3);
      } else {
        ans[i][j] = ((ans[i - 1][0]) + (ans[i - 1][1]) * 2);
      }
      ans[i][j] %= mod;
    }
  }
  cout << ans[n][0];
}
