#include <bits/stdc++.h>
using namespace std;
long long po(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = ((ans % 1000000007) * (a % 1000000007)) % 1000000007;
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
    b /= 2;
  }
  return ans % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  if (n == 0)
    cout << "1" << endl;
  else
    cout << ((po(2, 2 * n - 1) % 1000000007) + (po(2, n - 1) % 1000000007)) %
                1000000007
         << endl;
  return 0;
}
