#include <bits/stdc++.h>
using namespace std;
const int mx = 1e7 + 10;
long long dp[mx][2];
const int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = (dp[i - 1][1]) % mod;
    dp[i][1] = (dp[i - 1][0] * 3 + dp[i - 1][1] * 2) % mod;
  }
  cout << dp[n][0] << endl;
  return 0;
}
