#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int pow(long long int a, long long int b) {
  long long int base, res;
  base = a;
  res = 1;
  while (b) {
    if (b & 1) res = res * base % mod;
    base = base * base % mod;
    b = b >> 1;
  }
  return res;
}
int main() {
  long long int n;
  scanf("%I64d", &n);
  if (n == 0)
    cout << 1 << endl;
  else {
    long long int ans = 0;
    ans += pow(2, n - 1) + pow(2, 2 * n - 1);
    printf("%I64d\n", ans % mod);
  }
}
