#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long t1, t2, t3;
  t1 = 1;
  t2 = 3 * n;
  while (t2 > 0) {
    t1 *= 3LL;
    t1 %= 1000000007;
    t2--;
  }
  t3 = 1;
  t2 = n;
  while (t2 > 0) {
    t3 *= 7;
    t3 %= 1000000007;
    t2--;
  }
  t1 -= t3;
  t1 %= 1000000007;
  if (t1 < 0) t1 += 1000000007;
  cout << t1 << endl;
  return 0;
}
