#include <bits/stdc++.h>
using namespace std;
long long POW(long long x, long long y, long long n) {
  long long sol = 1, t = x, u = y;
  while (u) {
    if (u & 1) sol = (sol * t) % n;
    u >>= 1;
    t = (t * t) % n;
  }
  return sol;
}
int main() {
  long long n, tt;
  cin >> n;
  if (n == 0) {
    printf("1\n");
    return 0;
  }
  tt = POW(2LL, n - 1, 1000000007LL);
  n = POW(2LL, n, 1000000007LL);
  cout << (tt * (n + 1)) % 1000000007LL << endl;
  return 0;
}
