#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long upper = 1;
long long binpow(long long x, long long y) {
  x %= mod;
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % mod;
    x = x * x % mod;
    y /= 2;
  }
  return ans;
}
int main() {
  long long n = 0;
  cin >> n;
  if (n == 0)
    upper = 1;
  else
    upper = (binpow(2, n - 1) + binpow(2, 2 * n - 1));
  cout << upper % mod;
  return 0;
}
