#include <bits/stdc++.h>
using namespace std;
int deg(long long x, long long y) {
  long long int a = 1;
  while (y > 0) {
    if (y % 2 == 1) a = (a * x) % 1000000007;
    x = (x * x) % 1000000007;
    y = y / 2;
  }
  return a;
}
int main() {
  long long S = 1, n, fir, sec;
  cin >> n;
  if (n == 0) {
    cout << "1";
    return 0;
  }
  fir = ((deg(2, n - 1) + deg(2, 2 * n - 1))) % 1000000007;
  cout << fir;
}
