#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long long ans = 1, ans2 = 1;
  for (int i = 0; i < n; i++) {
    ans = (ans * 27);
    ans2 = (ans2 * 7);
    if (ans2 > 1000000007 || ans % 1000000007 > ans2) {
      ans %= 1000000007;
      ans2 %= 1000000007;
    }
  }
  cout << (1000000007 + ans - ans2) % 1000000007 << endl;
}
