#include <bits/stdc++.h>
using namespace std;
const unsigned long long m = 1000000007;
unsigned long long n;
unsigned long long sqr(unsigned long long x) { return (x) * (x); }
unsigned long long km(unsigned long long x, unsigned long long y) {
  if (y == 0) return 1;
  if (y == 1) return x % m;
  if (y % 2 == 0)
    return sqr(km(x, y / 2) % m) % m;
  else
    return sqr(km(x, y / 2) % m) % m * (x % m) % m;
}
int main() {
  cin >> n;
  if (n == 0)
    cout << 1 << endl;
  else
    cout << (km(2, n - 1) + km(2, 2 * n - 1)) % m << endl;
  return 0;
}
