#include <bits/stdc++.h>
using namespace std;
long long pow(int a, int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long temp;
  temp = pow(a, b / 2) % 1000000007;
  if (b % 2 == 0) return (temp * temp) % 1000000007;
  return ((temp * temp) % 1000000007 * a) % 1000000007;
}
int main() {
  int n;
  scanf("%d", &n);
  long long aa = pow(3, 3 * n);
  long long bb = pow(7, n);
  printf("%ld\n", (aa - bb + 1000000007) % 1000000007);
  return 0;
}
