#include <bits/stdc++.h>
using namespace std;
long long constexpr MOD = 1e9 + 7, N = 1e7 + 10;
long long n, dp[2][N] = {};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[0][i] = (dp[1][i - 1] * 3) % MOD;
    dp[1][i] = (dp[1][i - 1] * 2 + dp[0][i - 1]) % MOD;
  }
  cout << dp[0][n] << "\n";
  return 0;
}
