#include <bits/stdc++.h>
using namespace std;
unsigned long long fpow(unsigned long long a, unsigned long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 0) {
    unsigned long long ans = fpow(a, b / 2);
    return (ans * ans) % 1000000007;
  } else {
    unsigned long long ans = fpow(a, b / 2);
    ans = ((ans * ans) % 1000000007 * a % 1000000007) % 1000000007;
    return ans;
  }
}
int main() {
  unsigned long long n;
  cin >> n;
  unsigned long long ans = (fpow(27, n) - fpow(7, n) + 1000000007) % 1000000007;
  cout << ans;
}
