#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
long long a[1000005], n;
unordered_map<int, int> mp[100005];
long long ncr(int n, int r) {
  if (mp[n].find(r) != mp[n].end()) return mp[n][r];
  if (r == 0) return n % md;
  if (r < 0 || r > n) return 0;
  return mp[n][r] = (ncr(n - 1, r - 1) + ncr(n - 1, r)) % md;
}
long long power(long long a, long long p, long long m = 1e9 + 7,
                long long k = 0) {
  return p ? k = power(a, p / 2, m), (k * k % m) * (p & 1 ? a : 1) % m : 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long q, m, k, h, ans = 0, sum = 0, p, x, y;
  cin >> n;
  ans = power(3, 3 * n);
  sum = power(7, n);
  cout << (ans - sum + md) % md;
}
