#include <bits/stdc++.h>
using namespace std;
unsigned long long mod = (1e9) + 7;
int main() {
  long long n;
  cin >> n;
  unsigned long long sum = 1;
  for (int i = 0; i < n; i++) {
    sum *= 27;
    sum %= mod;
  }
  unsigned long long s = 1;
  for (int i = 0; i < n; i++) {
    s *= 7;
    s %= mod;
  }
  sum = (sum + mod - s) % mod;
  cout << sum;
  return 0;
}
