#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, m, k, p, ans, sum, tot, cnt, base, yoy;
long long q_pow(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    y = y >> 1;
  }
  return res;
}
signed main() {
  cin >> n;
  if (n == 0) {
    cout << "1";
    return 0;
  }
  cout << (q_pow(2, 2 * n - 1) + q_pow(2, n - 1)) % mod;
}
