#include <bits/stdc++.h>
using namespace std;
int main() {
  long long mod = 1000000007, col, o = 0, n, i, x, y, z;
  cin >> n;
  col = 1;
  o = 1;
  for (i = 0; i < n; ++i) {
    o = (o * 27) % mod;
    col = (col * 7) % mod;
  }
  cout << (o - col + mod) % mod;
  return 0;
}
