#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long int MOD = 1000000007LL;
long long int mod_pow(long long int x, long long int n) {
  if (n == 0LL) return 1LL;
  long long int res = mod_pow(x * x % MOD, n / 2LL);
  if (n & 1LL) res = res * x % MOD;
  return res;
}
int main() {
  long long int n;
  while (cin >> n) {
    if (n == 0LL) {
      cout << "1" << endl;
      continue;
    }
    long long int diff = mod_pow(2LL, n - 1LL);
    cout << (diff * diff * 2LL + diff) % MOD << endl;
  }
  return 0;
}
