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