#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
int main() {
  long long a, b = 1, c, d = 1;
  cin >> a;
  c = 3 * a;
  for (int i = 1; i <= a; i++) {
    b = b * 7;
    b %= MOD;
  }
  for (int i = 1; i <= c; i++) {
    d = d * 3;
    d %= MOD;
  }
  cout << (d + MOD - b) % MOD;
  return 0;
}
