#include <bits/stdc++.h>
using namespace std;
long long M = 1000000007;
long long bigMod(long long n, long long power, long long mod = M) {
  if (power == 0) return 1;
  if (power == 1)
    return n % mod;
  else if (power % 2 == 0) {
    long long v = bigMod(n, power / 2, mod);
    return ((v % mod) * (v % mod)) % mod;
  } else {
    long long v = bigMod(n, power - 1, mod) % mod;
    return ((v % mod) * (n % mod)) % mod;
  }
}
int main() {
  long long n;
  scanf("%lld", &n);
  long long number = bigMod(2, n);
  cout << ((number * (number + 1)) / 2) % M << endl;
  return 0;
}
