#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long N = 1e5 + 7;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first < b.first;
}
long long fastmod(long long b, long long e) {
  if (e == 0) return 1;
  if (e == 1) return b % MOD;
  long long temp = fastmod(b, e / 2);
  temp = (temp * temp) % MOD;
  if (e % 2 == 0)
    return temp;
  else
    return (temp * (b % MOD)) % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  long long tot = fastmod(3, 3 * n);
  long long notpos = fastmod(7, n);
  cout << ((tot % MOD) - (notpos % MOD) + MOD) % MOD;
  return 0;
}
