#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n;
long long power(long long x, int p) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = ans * x % mod;
    x = x * x % mod;
    p = p / 2;
  }
  return ans;
}
int main() {
  cin >> n;
  long long ans = power(3, 3 * n);
  ans -= power(7, n);
  ans = (ans % mod + mod) % mod;
  cout << ans << endl;
}
