#include <bits/stdc++.h>
using namespace std;
long n;
const long MOD = 1000000000 + 7;
long long pm(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return ans;
}
int main() {
  scanf("%ld", &n);
  printf("%I64d\n", (pm(27, n) - pm(7, n) + MOD) % MOD);
  return 0;
}
