#include <bits/stdc++.h>
using namespace std;
template <class T>
T min3(T a, T b, T c) {
  return min(a, min(b, c));
};
template <class T>
T max3(T a, T b, T c) {
  return max(a, max(b, c));
};
void openFile() {
  freopen("/home/khaihanhdk/MyWorkplace/cpp file/a.inp", "r", stdin);
}
const long long mm = (long long)(1e9 + 7);
long long fastpow(long long a, int n) {
  if (n == 0) return 1;
  long long h = fastpow(a, n >> 1);
  if (n & 1) return (((h * h) % mm) * a) % mm;
  return (h * h) % mm;
}
int main() {
  int n;
  scanf("%d", &n);
  cout << (fastpow(3LL, 3 * n) - fastpow(7LL, n) + mm) % mm << endl;
}
