#include <bits/stdc++.h>
using namespace std;
long long int pow1(long long int a, long long int n, long long int m) {
  if (n == 0) return 1 % m;
  if (n == 1) return a % m;
  long long int t = pow1(a, n / 2, m) % m;
  t = (t * t) % m;
  if (n % 2) t = (t * a) % m;
  return t % m;
}
long long int n, i, t, f;
int main() {
  cin >> n;
  t = pow1(2, n, 1000000007);
  t = (t) * (t + 1) / 2;
  t = t % 1000000007;
  cout << t << endl;
  return 0;
}
