#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxs = 20;
long long fxn(long long x, long long n) {
  long long result = 1LL;
  for (long long tag = n; tag > 0; tag >>= 1) {
    if (tag & 1) result = (result * x) % mod;
    x = (x * x) % mod;
  }
  return result;
}
int main() {
  long long n;
  long long t1 = 1LL;
  cin >> n;
  if (n == 0)
    cout << 1 << endl;
  else {
    long long a1 = fxn(2, n - 1);
    long long a2 = fxn(2, n);
    a2 = (a2 + 1) % mod;
    long long res = (a1 * a2) % mod;
    cout << res << endl;
  }
  return 0;
}
