#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long awal, akh, ans;
  scanf("%d", &n);
  awal = 3;
  akh = 7;
  for (int i = 1; i < (3 * n); i++) {
    awal = (awal * 3) % 1000000007;
  }
  for (int i = 1; i < n; i++) {
    akh = (akh * 7) % 1000000007;
  }
  while (awal <= akh) {
    awal = awal + 1000000007;
  }
  ans = (awal - akh) % 1000000007;
  cout << ans << endl;
}
