#include <bits/stdc++.h>
using namespace std;
static const long long maxLL = (long long)1 << 62;
const long long MOD = 1000000007;
const long long INF = 1e18;
long long N;
long long dp[2][4];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  dp[0][0] = 1;
  for (long long i = 0; i < N - 1; i++) {
    (dp[(i + 1) % 2][0] = dp[i % 2][1] + dp[i % 2][2] + dp[i % 2][3]) %= MOD;
    (dp[(i + 1) % 2][1] = dp[i % 2][0] + dp[i % 2][2] + dp[i % 2][3]) %= MOD;
    (dp[(i + 1) % 2][2] = dp[i % 2][0] + dp[i % 2][1] + dp[i % 2][3]) %= MOD;
    (dp[(i + 1) % 2][3] = dp[i % 2][0] + dp[i % 2][1] + dp[i % 2][2]) %= MOD;
  }
  cout << (dp[(N - 1) % 2][1] + dp[(N - 1) % 2][2] + dp[(N - 1) % 2][3]) % MOD
       << '\n';
  return 0;
}
