#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& is, vector<T>& x) {
  for (long long i = 0; i < (((long long)((x).size()))); i++) is >> x[i];
  return is;
}
template <class A, class B>
istream& operator>>(istream& is, tuple<A, B>& x) {
  is >> get<0>(x) >> get<1>(x);
  return is;
}
template <class T>
ostream& operator<<(ostream& os, vector<T>& x) {
  os << "[";
  for (long long i = 0; i < (((long long)((x).size()))); i++)
    if (i != x.size() - 1) os << x[i] << " ";
  os << "]";
  return os;
}
template <class A, class B>
ostream& operator<<(ostream& os, tuple<A, B>& x) {
  os << "(" << get<0>(x) << "," << get<1>(x) << ")";
  return os;
}
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
long long mypow(long long x, long long n) {
  if (n == 0) return 1;
  long long res = mypow(x * x % mod, n / 2);
  if (n & 1) res = res * x % mod;
  return res;
}
void run() {
  long long n;
  cin >> n;
  if (n == 0)
    cout << 1 << endl;
  else
    cout << (1 + mypow(2, n)) * mypow(2, n - 1) % mod << endl;
}
int main(int argc, char* argv[]) {
  run();
  return 0;
}
