#include <bits/stdc++.h>
using namespace std;
long long Mode(long long a, long long b, long long mode) {
  long long sum = 1;
  a = a % mode;
  while (b > 0) {
    if (b % 2 == 1) sum = (sum * a) % mode;
    b /= 2;
    a = (a * a) % mode;
  }
  return sum;
}
int main(void) {
  long long n, ans;
  cin >> n;
  ans = (Mode(3, 3 * n, 1000000007) + 1000000007 - Mode(7, n, 1000000007)) %
        1000000007;
  cout << ans << endl;
  return 0;
}
