#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long int n, i, res, res1;
  cin >> n;
  res = 1;
  for (i = 0; i < n; i++) {
    res = (res * 27) % 1000000007;
  }
  res1 = 1;
  for (i = 0; i < n; i++) {
    res1 = (res1 * 7) % 1000000007;
  }
  cout << (res - res1 + 1000000007) % 1000000007;
}
