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