#include <bits/stdc++.h>
using namespace std;
int t, n;
long long base = 1000000007;
long long POWER(int x, int k) {
  if (k == 1) return x;
  long long y = POWER(x, k / 2);
  y = (y * y) % base;
  if (k % 2) y = (y * x) % base;
  return y % base;
}
int main() {
  cin >> n;
  cout << (POWER(3, 3 * n) + base - POWER(7, n)) % base;
  return 0;
}
