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