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