#include <bits/stdc++.h>
long long power(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = (res * x) % 1000000007;
    x = (x * x) % 1000000007;
    y /= 2;
  }
  return res;
}
int main() {
  long long n;
  scanf("%lld", &n);
  long long expl, exph, ans;
  if (n == 0) {
    printf("1");
    return 0;
  }
  expl = power(2, n - 1);
  exph = power(2, n) + 1;
  ans = (expl * exph) % 1000000007;
  printf("%lld", ans);
  return 0;
}
