#include <bits/stdc++.h>
using namespace std;
unsigned long long md = 1e9 + 7;
unsigned long long pw(unsigned long long k, unsigned long long n) {
  if (n == 0) return 1;
  unsigned long long tmp = n / 2;
  unsigned long long tmp2 = pw(k, tmp);
  tmp2 *= tmp2;
  tmp2 %= md;
  if (n % 2) tmp2 *= k;
  tmp2 %= md;
  return tmp2;
}
int main() {
  unsigned long long n;
  cin >> n;
  if (n == 0)
    cout << 1 << endl;
  else
    cout << (pw(2, n - 1) * (pw(2, n) + 1)) % md << endl;
  return 0;
}
