#include <bits/stdc++.h>
using namespace std;
long long p27[100005];
long long p7[100005];
int main() {
  int n;
  cin >> n;
  p27[0] = p7[0] = 1;
  for (int i = 1; i <= n; i++) {
    p27[i] = (27LL * p27[i - 1]) % 1000000007;
    p7[i] = (7LL * p7[i - 1]) % 1000000007;
  }
  cout << ((p27[n] - p7[n]) % 1000000007 + 1000000007) % 1000000007 << endl;
}
