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