#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("popcnt")
void MP() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const long long MAX = (long long)1e6 + 15;
const long long MAX2 = 31;
const long double EPS = 1e-8;
const long long sigma = 128;
const long long delta = (long long)1e6 + 3;
const long long MAXB = (1 << 10);
inline bool gt(long long a, long long i) { return (a >> i) & 1; }
const long long MOD = (long long)1e9 + 7;
long long add(long long a, long long b) {
  if (a + b > MOD) return a + b - MOD;
  return a + b;
}
void solve() {
  long long n;
  cin >> n;
  long long dp[2][4];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (long long i = (1); i < n + 1; ++i) {
    for (long long j = 0; j < 4; ++j) {
      dp[i % 2][j] = 0;
      for (long long k = 0; k < 4; ++k) {
        if (j != k) dp[i % 2][j] = add(dp[i % 2][j], dp[(i + 1) % 2][k]);
      }
    }
  }
  cout << (dp[n % 2][0]) << '\n';
}
signed main() {
  MP();
  solve();
}
