#include <bits/stdc++.h>
using namespace std;
long long two(long long first) {
  if (first == 0) return 1;
  if (first == 1) return 2;
  long long second = two(first >> 1);
  return (second * second * (first & 1 ? 2 : 1)) % 1000000007;
}
int main(int argc, char **argv) {
  long long N;
  cin >> N;
  if (N == 0)
    cout << "1" << endl;
  else
    cout << (two(N - 1) * (1 + two(N)) % 1000000007) << endl;
  return 0;
}
