#include <bits/stdc++.h>
using namespace std;
int n, l, r, st;
const int mod = 1000000007;
const int N = 1e7 + 2;
int dp[2][N];
int main() {
  cin >> n;
  dp[1][0] = 1;
  for (st = 1; st < N; st++) {
    dp[1][st] = (3LL * dp[0][st - 1]) % mod;
    dp[0][st] = (2LL * dp[0][st - 1] + dp[1][st - 1]) % mod;
  }
  cout << dp[1][n];
  return 0;
}
