#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1E9 + 7;
inline long long mod(long long x) { return (x % MOD + MOD) % MOD; }
int main() {
  int N;
  scanf("%d", &N);
  long long resp = 1LL;
  for (int i = 1; i <= 3 * N; i++) resp = mod(resp * 3);
  long long aux = 1LL;
  for (int i = 1; i <= N; i++) aux = mod(aux * 7);
  resp = mod(resp - aux);
  printf("%d\n", resp);
  return 0;
}
