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