#include <bits/stdc++.h>
using namespace std;
long long fastPow(int b, long long e) {
  if (e == 0) return 1;
  long long po = fastPow(b, e / 2);
  po = (po * po) % 1000000007;
  if (e & 1) return (po * b) % 1000000007;
  return po;
}
int main() {
  long long n;
  while (cin >> n) {
    long long ans = fastPow(2, n);
    ans = (ans * (ans + 1)) % 1000000007;
    ans = (ans * fastPow(2, 1000000007 - 2)) % 1000000007;
    cout << ans << endl;
  }
}
