#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;
  if (d % 2 == 1) b *= a;
  return (b % 1000000007);
}
int main() {
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long a = 1;
  for (int i = 0; i < n; ++i) a = (a * 27) % 1000000007;
  long long b = 1;
  for (int i = 0; i < n; ++i) b = (b * 7) % 1000000007;
  cout << (a - b + 1000000007) % 1000000007 << endl;
}
