#include <bits/stdc++.h>
using namespace std;
int ky[8] = {-1, 1, -2, 2, -2, 2, -1, 1};
int kx[8] = {-2, -2, -1, -1, 1, 1, 2, 2};
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
long long a, b;
int n;
long long ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int t = 3 * n;
  a = b = 1LL;
  for (int i = 1; i <= t; i++) a = (3 * a) % 1000000007;
  for (int i = 1; i <= n; i++) b = (7 * b) % 1000000007;
  ans = (a % 1000000007) - (b % 1000000007);
  if (ans < 0) ans += 1000000007;
  cout << ans;
  return 0;
}
