#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, ans, temp = 1, temp1 = 1;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    temp = (temp % long(1e9 + 7) * 27) % long(1e9 + 7);
    temp1 = (temp1 % long(1e9 + 7) * 7) % long(1e9 + 7);
  }
  printf("%lld\n", (temp - temp1 + long(1e9 + 7)) % long(1e9 + 7));
  return 0;
}
