#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 100005;
int dp[2][4];
int main() {
  int n;
  scanf("%d", &n);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    memset(dp[i & 1], 0, sizeof(dp[i & 1]));
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        if (j == k) continue;
        dp[i & 1][j] += dp[1 - i & 1][k];
        dp[i & 1][j] %= mod;
      }
    }
  }
  printf("%d\n", dp[n & 1][0]);
  return 0;
}
