#include <bits/stdc++.h>
long long power(long long base, long long p) {
  long long ans = 1;
  while (p) {
    if (p % 2 == 1) ans = ans * base % 1000000007;
    base = base * base % 1000000007;
    p /= 2;
  }
  return ans;
}
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  int n;
  long long ans;
  std::cin >> n;
  ans = power(3, 3 * n) - power(7, n);
  if (ans < 0) ans += 1000000007;
  std::cout << ans << '\n';
  return 0;
}
