#include <bits/stdc++.h>
using namespace std;
int powmod(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  long long int a, d, n, p;
  cin >> n;
  p = 1000000007;
  a = powmod(3, 3 * n, p);
  d = powmod(7, n, p);
  cout << (a % p - d % p + p) % p;
}
