#include <bits/stdc++.h>
using namespace std;
int power(int x, int y) {
  long long cnt = 1;
  for (int i = 0; i < y; i++) cnt = ((cnt * x) % (1000000007ll));
  return cnt;
}
int main() {
  int n;
  cin >> n;
  cout << (((power(3ll, 3ll * n) - power(7ll, n))) + (1000000007ll)) %
              (1000000007ll);
}
