#include <bits/stdc++.h>
using namespace std;
long long FastPowMod(long long x, long long y, int mod) {
  if (y == 0) return 1;
  long long res = FastPowMod(x, y / 2, mod) % mod;
  if (y % 2 == 0)
    return (res * res) % mod;
  else
    return (((x * res) % mod) * res) % mod;
}
int main() {
  long long N;
  cin >> N;
  long long res = FastPowMod(3, 3 * N, 1000000007);
  long long rem = FastPowMod(7, N, 1000000007);
  if (res >= rem)
    cout << res - rem;
  else
    cout << ((res + 1000000007) - rem) % 1000000007;
}
