#include <bits/stdc++.h>
using namespace std;
long long pwr(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = ((ans % 1000000007) * (a % 1000000007)) % 1000000007;
    }
    b /= 2;
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  ;
  long long ans = (pwr(3, 3 * n) - pwr(7, n) + 1000000007) % 1000000007;
  cout << ans << endl;
}
