#include <bits/stdc++.h>
using namespace std;
long long dp[100010][3];
long long m = 1000000007;
int n;
long long f(int i, int ok) {
  if (i == n) return ok;
  if (dp[i][ok] != -1) return dp[i][ok];
  long long ans = 0;
  int tot = 0;
  for (int a = 1; a < 4; a++)
    for (int b = 1; b < 4; b++)
      for (int c = 1; c < 4; c++) {
        tot = a + b + c;
        if (tot == 6) {
          ans = ans + f(i + 1, ok);
        } else {
          ans = ans + f(i + 1, 1);
        }
        ans = ans % m;
      }
  return dp[i][ok] = ans % m;
}
int main(int argc, char const *argv[]) {
  cin >> n;
  memset(dp, -1, sizeof(dp));
  cout << f(0, 0) << endl;
  return 0;
}
