#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int n;
long long lt(long long a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    b >>= 1;
    a = (a * a) % MOD;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cout << (lt(3, n * 3) - lt(7, n) + MOD) % MOD;
  return 0;
}
