#include <bits/stdc++.h>
using namespace std;
long long power(long long first, long long k) {
  long long ans = 1;
  for (long long i = 1; i <= k; i++) {
    ans = ((ans % 1000000007) * (first % 1000000007)) % 1000000007;
  }
  return ans;
}
signed main() {
  long long n;
  cin >> n;
  long long temp = power(3, 3 * n);
  long long temp2 = power(7, n);
  cout << (1000000007 + temp - temp2) % 1000000007 << '\n';
}
