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