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