#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e15 + 7;
const long long M = 1e9 + 7;
const long long NN = 1e7 + 7;
long long dp[NN][2];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  dp[1][0] = 0;
  dp[1][1] = 1;
  for (__typeof(2) i = 2; i < n + 1; ++i) {
    for (__typeof(0) j = 0; j < 2; ++j) {
      if (j == 0)
        dp[i][j] = 3 * dp[i - 1][1];
      else
        dp[i][j] = dp[i - 1][0] + 2 * (dp[i - 1][1]);
      dp[i][j] %= M;
    }
  }
  cout << dp[n][0] << "\n";
}
