#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int maxn = 1e5 + 100;
long long int a[maxn], b[maxn];
int main() {
  long long int n, sum = 0;
  cin >> n;
  a[0] = b[0] = 1;
  for (int i = 1; i < maxn; i++) a[i] = (a[i - 1] * 27) % MOD;
  for (int i = 1; i < maxn; i++) b[i] = (b[i - 1] * 7) % MOD;
  for (int i = 1; i <= n; i++) sum += (a[n - i] * b[i - 1]) % MOD;
  sum = (sum * 20) % MOD;
  cout << sum;
  return 0;
}
