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