#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
const double eps = 1e-9L;
const double pi = acos(-1.0);
using namespace std;
unsigned long long big(long long P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    unsigned long long mod = big(P / 2);
    return (mod * mod) % 1000000007;
  }
  return (2 * big(P - 1)) % 1000000007;
}
int main() {
  unsigned long long m, a, b;
  cin >> m;
  unsigned long long result;
  if (m == 0)
    result = 1;
  else {
    a = big(m - 1);
    b = (a * 2) % 1000000007;
    result = (a * (b + 1)) % 1000000007;
  }
  cout << result << endl;
  return 0;
}
