#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
const int oo = 1e9 + 7;
const int Dx[4] = {0, 0, -1, 1};
const int Dy[4] = {1, -1, 0, 0};
int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  long long fir = 1, lst = 1;
  for (int i = 1; i <= 3 * n; i++) fir = (fir * 3) % oo;
  for (int i = 1; i <= n; i++) lst = (lst * 7) % oo;
  cout << (fir + oo - lst) % oo;
  return 0;
}
