#include <bits/stdc++.h>
using namespace std;
long long rec(long long y, long long x) {
  if (x == 0LL) {
    return 1;
  }
  if (x % 2LL == 0LL) {
    long long c = rec(y, x / 2);
    return (c % 1000000007LL) * (c % 1000000007LL) % 1000000007LL;
  }
  return rec(y, x - 1) * 2 % 1000000007LL;
}
long long i, n, q, q1, q2;
int main() {
  cin >> n;
  if (n == 0) {
    cout << 1 << endl;
    return 0;
  }
  q = rec(2, 2 * n - 1);
  q1 = rec(2, n - 1);
  cout << (q1 + q) % 1000000007LL << endl;
  return 0;
}
