#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if (y == 0) {
    return x;
  }
  return gcd(y, x % y);
}
void solve() {
  int n;
  cin >> n;
  int dp[n + 1][4];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 4; j++) {
      int sum = 0;
      for (int k = 0; k < 4; k++) {
        if (k != j) {
          sum = sum % (int)(1e9 + 7) + dp[i - 1][k] % (int)(1e9 + 7);
        }
      }
      sum = sum % (int)(1e9 + 7);
      dp[i][j] = dp[i][j] % (int)(1e9 + 7) + sum % (int)(1e9 + 7);
      dp[i][j] = dp[i][j] % (int)(1e9 + 7);
    }
  }
  cout << dp[n][0] << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
