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