#include <bits/stdc++.h>
using namespace std;
long long int power(long long int base, long long int exp) {
  long long int res = 1;
  base = base % 1000000007;
  while (exp) {
    if (exp & 1) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    exp >>= 1;
  }
  return res;
}
int main() {
  long long int n;
  scanf("%lld", &n);
  if (n == 0)
    printf("1\n");
  else
    printf("%lld\n", power(2, n - 1) * (power(2, n) + 1) % 1000000007);
  return 0;
}
