#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  long long int t = 1, r = 1;
  for (int i = 0; i < int(n); i++) {
    t = (t * 27) % MOD;
    r = (r * 7) % MOD;
  }
  long long int cant = (t - r + MOD) % MOD;
  cout << cant << endl;
  return 0;
}
