#include <bits/stdc++.h>
using namespace std;
long long bpow(long long a, long long d) {
  if (d == 1) return a;
  long long b;
  b = bpow(a, d / 2);
  b = (b * b) % 1000000007;
  if (d % 2 == 1) b *= a;
  return (b % 1000000007);
}
int main() {
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long res = bpow(27, n) - bpow(7, n);
  while (res < 0) res += 1000000007;
  cout << res;
}
