#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  scanf("%lld", &n);
  long long int mul = 1;
  for (int i = 0; i < 3 * n; i++) mul = (mul * 3) % 1000000007;
  long long int mul1 = 1;
  for (int i = 0; i < n; i++) mul1 = (mul1 * 7) % 1000000007;
  mul -= mul1;
  if (mul < 0) mul += 1000000007;
  printf("%lld\n", mul);
  return 0;
}
