#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long now = power(a, b / 2);
    return (now * now) % mod;
  } else
    return (a * power(a, b - 1)) % mod;
}
int main() {
  long long n;
  cin >> n;
  if (n == 0)
    cout << 1 << endl;
  else {
    long long res = 1;
    res = (res * power(2, n - 1)) % mod;
    res = (res * (power(2, n) + 1)) % mod;
    cout << res << endl;
  }
}
