#include <bits/stdc++.h>
using namespace std;
long long m = 1000000007;
long long modpow(long long base, long long exp) {
  long long result = 1;
  while (exp > 0) {
    if ((exp & 1) > 0) result = (result * base) % m;
    exp >>= 1;
    base = (base * base) % m;
  }
  return result;
}
int main() {
  long long n;
  cin >> n;
  long long a = modpow(2, n);
  long long count = 0;
  for (long long i = 1; i <= a; i++) {
    count += i;
  }
  cout << count % m << endl;
  return 0;
}
