#include <bits/stdc++.h>
using namespace std;
long long int BigMod(long long int a, long long int b, long long int mod) {
  if (b == 0) return 1;
  long long int x = BigMod(a, b / 2, mod);
  x = (x * x) % mod;
  if (b % 2 == 1) x = (x * a % mod) % mod;
  return x % mod;
}
int main() {
  long long int n;
  cin >> n;
  long long int x = BigMod(3, 3 * n, 1000000007);
  long long int y = BigMod(7, n, 1000000007);
  x = x - y;
  x += 1000000007;
  cout << x % 1000000007;
  return 0;
}
