#include <bits/stdc++.h>
using namespace std;
long long pow(long long m) {
  if (m == 0) return 1 % 1000000007;
  long long temp = pow(m >> 1) % 1000000007;
  temp = temp * temp % 1000000007;
  if (m & 1) temp = temp * 2 % 1000000007;
  return temp;
}
int main() {
  long long n;
  while (scanf("%I64d", &n) == 1) {
    printf("%I64d\n", n ? (pow(2 * n - 1) + (pow(n - 1))) % 1000000007 : 1);
  }
  return 0;
}
