#include <bits/stdc++.h>
#pragma GCC optimize("-Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  long long s = 1, t = 1;
  cin >> n;
  for (int i = 0; i < 3 * n; i++) {
    t = (t % 1000000007 * 3) % 1000000007;
  }
  for (int i = 0; i < n; i++) {
    s = (s % 1000000007 * 7) % 1000000007;
  }
  long long ans = (((t - s) + 1000000007) % 1000000007);
  cout << ans << endl;
  return 0;
}
