#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  long long ans = 1, tmp = 1;
  cin >> n;
  for (i = 0; i < 3 * n; i++) ans = (ans * 3) % 1000000007;
  for (i = 0; i < n; i++) tmp = (tmp * 7) % 1000000007;
  ans = (ans - tmp + 1000000007) % 1000000007;
  cout << ans << endl;
  return 0;
}
