#include <bits/stdc++.h>
using namespace std;
long long pow(int a, long long b) {
  long long r = 1, base = a;
  while (b != 0) {
    r %= 1000000007;
    base %= 1000000007;
    if (b & 1) r *= base;
    base *= base;
    b >>= 1;
    base %= 1000000007;
  }
  r %= 1000000007;
  return r;
}
long long n;
int main() {
  while (scanf("%I64d", &n) != EOF) {
    if (n == 0) {
      printf("1\n");
      continue;
    }
    long long ans1 = pow(2, n);
    long long ans2 = pow(2, n - 1);
    printf("%I64d\n", ((ans1 + 1) * ans2) % 1000000007);
  }
  return 0;
}
