#include <bits/stdc++.h>
using namespace std;
const int OO = (int)1e9;
int dx[8] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
long long n;
long long MOD = 1000000000 + 7;
long long power(long long base, long long pwr) {
  long long result = 1;
  while (pwr > 0) {
    if (pwr % 2 == 1) {
      result = (result * base) % MOD;
    }
    base = (base * base) % MOD;
    pwr = pwr / 2;
  }
  return result;
}
int main() {
  cin >> n;
  n = power(2, n);
  cout << (n * (n + 1) / 2) % MOD << endl;
  return 0;
}
