#include <bits/stdc++.h>
using namespace std;
long long n, dp[10000007], inf = 1e9 + 7;
int main() {
  cin >> n;
  dp[0] = 1;
  dp[1] = 0;
  dp[2] = 3;
  for (int i = 3; i <= n; i++) {
    dp[i] = dp[i - 1] * 2 + dp[i - 2] * 3;
    dp[i] %= inf;
  }
  cout << dp[n];
}
