#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
long long n;
long long pw(long long b, long long p) {
  long long result = 1;
  while (p) {
    if (p % 2) result = (result * b) % 1000000007;
    p /= 2;
    b = (b * b) % 1000000007;
  }
  return result;
}
int main() {
  scanf("%lld", &n);
  if (n == 0) {
    puts("1");
    return 0;
  }
  long long ans = pw(2, n - 1) * (1 + pw(2, n)) % 1000000007;
  printf("%lld\n", ans);
  return 0;
}
