#include <bits/stdc++.h>
using namespace std;
long long pow(long long base, long long power) {
  long long temp;
  if (power == 0) return 1;
  temp = pow(base, power / 2);
  temp %= 1000000007;
  if (power % 2 == 0) return (temp * temp) % 1000000007;
  return (((temp * temp) % 1000000007) * base) % 1000000007;
}
int main() {
  long long n;
  cin >> n;
  long long b = pow(2, n);
  long long ans = b * b + b;
  ans /= 2;
  ans %= 1000000007;
  cout << ans;
  return 0;
}
