#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, Mod = 1e9 + 7;
long long int bigmod(long long int b, long long int p, long long int m) {
  long long int Ret = 1;
  while (p) {
    if (p & 1) Ret = (Ret * b) % m;
    b = (b * b) % m;
    p >>= 1;
  }
  return Ret;
}
int main() {
  long long int n;
  cin >> n;
  cout << (bigmod(3LL, 3 * n, Mod) - bigmod(7LL, n, Mod) + Mod) % Mod << "\n";
  return 0;
}
