#include <bits/stdc++.h>
using namespace std;
long long fast_pow(long long a, long long n) {
  long long result = 1;
  long long power = n;
  long long value = a;
  while (power > 0) {
    if (power & 1) {
      result = result * value;
      result = result % 1000000007;
    }
    value = value * value;
    value = value % 1000000007;
    power /= 2;
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long x;
  cin >> x;
  long long res = fast_pow(2, x);
  long long ans = (res * (res + 1)) / 2;
  cout << ans % 1000000007 << endl;
  return 0;
}
