#include <bits/stdc++.h>
using namespace std;
int N;
long long power(long long a, int b) {
  if (b == 0) return 1;
  if (b % 2 == 1) {
    long long temp = power(a, b / 2) % 1000000007;
    return (((temp * temp) % 1000000007) * a) % 1000000007;
  } else {
    long long temp = power(a, b / 2) % 1000000007;
    return (temp * temp) % 1000000007;
  }
}
int main() {
  cin >> N;
  int temp = (power(3, 3 * N) - power(7, N) + 1000000007) % 1000000007;
  cout << temp;
}
