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