#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long Modular_Exponentiation(long long x, long long n, long long M) {
  if (n == 0) return 1;
  if (n % 2)
    return (x * Modular_Exponentiation((x * x) % M, n / 2, M)) % M;
  else
    return (Modular_Exponentiation((x * x) % M, n / 2, M)) % M;
}
void solve() {
  long long n;
  cin >> n;
  cout << (Modular_Exponentiation(27, n, 1000000007) -
           Modular_Exponentiation(7, n, 1000000007) + 1000000007) %
              1000000007;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) solve();
  cerr << "Time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  cerr << "My CLOCKS_PER_SEC= " << CLOCKS_PER_SEC << "\n";
  return 0;
}
