#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(1e9);
const int mod = inf + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
long long n, inv3;
long long binpow(long long a, long long k) {
  if (k == 0) return 1ll;
  long long res = binpow(a, k / 2);
  res = (res * res) % mod;
  if (k % 2) res = (res * a) % mod;
  return res;
}
long long inv(long long a) { return binpow(a, mod - 2); }
int main() {
  inv3 = inv(3ll);
  cin >> n;
  if (n == 0)
    cout << 1;
  else {
    cout << ((2ll * binpow(4ll, n - 1)) % mod + binpow(2ll, n - 1)) % mod;
  }
  return 0;
}
