#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a * (b / gcd(a, b));
}
long long int power(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = ((ans % 1000000007) * (a % 1000000007)) % 1000000007;
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
    b >>= 1;
  }
  return ans;
}
int main() {
  long long int n;
  cin >> n;
  long long int temp1, temp2;
  temp1 = power(27, n);
  temp2 = power(7, n);
  cout << (temp1 + 1000000007 - temp2) % 1000000007 << endl;
  return 0;
}
