#include <bits/stdc++.h>
using namespace std;
long long int modexp(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b /= 2;
  }
  return res;
}
const long long int N = 10000002;
long long int dp[2][N];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  dp[0][0] = 0;
  dp[1][0] = 1;
  for (long long int steps = 1; steps < N; steps++) {
    dp[0][steps] = (2LL * dp[0][steps - 1] + dp[1][steps - 1]) % 1000000007;
    dp[1][steps] = (3LL * dp[0][steps - 1]) % 1000000007;
  }
  cout << dp[1][n];
  return 0;
}
