#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;
int dp[2][4];
int main() {
  int n;
  cin >> n;
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = 0; j < 4; j++) {
      sum += dp[i & 1][j];
      sum %= mod;
    }
    for (int j = 0; j < 4; j++) {
      int cur = (sum - dp[i & 1][j] + mod) % mod;
      dp[(i + 1) & 1][j] = cur;
    }
  }
  cout << dp[n & 1][0] << endl;
  return 0;
}
