#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
long long modPow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * a % M;
    a = a * a % M;
    n /= 2;
  }
  return res;
}
int main() {
  long long n;
  while (cin >> n) {
    if (n == 0)
      cout << "1" << endl;
    else
      cout << (modPow(2, 2 * n - 1) + modPow(2, n - 1)) % M << endl;
  }
  return 0;
}
