#include <bits/stdc++.h>
using namespace std;
int A[100005];
long long fast_pow(long long base, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    n = n >> 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  long long ans = fast_pow(3, n * 3) - fast_pow(7, n);
  if (ans < 0) ans += 1000000007;
  cout << ans;
  return 0;
}
