#include <bits/stdc++.h>
using namespace std;
int exp(long long p) {
  long long a = 1;
  for (long long b = 2; p; p >>= 1, b = b * b % 1000000007)
    if (p & 1) a = a * b % 1000000007;
  return a;
}
int main() {
  long long n;
  while (cin >> n) {
    if (n == 0)
      cout << "1" << endl;
    else
      cout << (exp(n - 1) + exp(n + n - 1)) % 1000000007 << endl;
  }
  return 0;
}
