#include <bits/stdc++.h>
using namespace std;
long long qpow(long long a, long long n) {
  if (!n) return 1LL;
  if (n % 2) {
    return (a * qpow(a, n - 1)) % (1000000007LL);
  }
  return qpow((a * a) % (1000000007LL), n / 2);
}
int main() {
  int i, j;
  long long n;
  cin >> n;
  long long all = qpow(4, n);
  long long diff = qpow(2, n);
  all -= diff;
  if (all < 0) all += (1000000007LL);
  if (all % 2) all += (1000000007LL);
  all = (all / 2 + diff) % (1000000007LL);
  cout << all << endl;
  return 0;
}
