#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  int l = v.size();
  for (int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
const long long mod = 1e9 + 7;
long long add(long long x, long long y) {
  x += y;
  if (x >= mod) return x % mod;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return (x + mod) % mod;
  return x;
}
long long mult(long long x, long long y) { return (x * y) % mod; }
long long expp(long long x, long long b) {
  long long ret = 1;
  while (b > 0) {
    if (b % 2 == 1) ret = (ret * x) % mod;
    x = (x * x) % mod;
    b /= 2;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  long long x = expp(3, 3 * n);
  long long y = expp(7, n);
  long long ans = sub(x, y);
  cout << ans << endl;
}
