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