#include <bits/stdc++.h>
using namespace std;
const int delta = (int)1e9 + 7;
long long n, all, bad, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  all = bad = 1;
  for (int i = 0; i < n; ++i) {
    all = (all * 27) % delta;
    bad = (bad * 7) % delta;
  }
  ans = (all - bad + delta) % delta;
  cout << ans;
  return cout << endl, 0;
}
