#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  long long int ans = 1;
  long long int x = 1;
  for (int i = 1; i <= 3 * n; i++) {
    ans = (ans * 3) % 1000000007;
  }
  for (int i = 1; i <= n; i++) {
    x = (x * 7) % 1000000007;
  }
  ans = ans - x;
  if (ans < 0) {
    ans += 1000000007;
  }
  cout << ans << "\n";
  return 0;
}
