#include <bits/stdc++.h>
using namespace std;
const int maxt = 2;
unsigned long long int mod = 1000000007;
unsigned long long int modPow(unsigned long long int x,
                              unsigned long long int y);
unsigned long long int modPow(unsigned long long int x,
                              unsigned long long int exp) {
  unsigned long long int r = 1;
  x = x % mod;
  while (exp > 0) {
    if (exp & 1) r = (r * x) % mod;
    exp /= 2;
    x = (x * x) % mod;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  unsigned long long int n;
  cin >> n;
  unsigned long long int pown, pownm;
  pown = modPow(2, n);
  pownm = modPow(2, n - 1);
  pown = (pown + 1) % mod;
  unsigned long long int res = 1;
  if (n > 0) res = (pownm * pown) % mod;
  cout << res << '\n';
  return 0;
}
