#include <bits/stdc++.h>
using namespace std;
int q = 0, w = 0, e = 0, r = 0, t = 0, y = 0, u = 0, i = 0, o = 0, a = 0, s = 0,
    d = 0, f = 0, g = 0, h = 0, j = 0, k = 0, l = 0, z = 0, x = 0, c = 0, v = 0,
    b = 0, m = 0, cnt = 0, d1 = 0, d2 = 0, ans = 0;
long long fast_power(long long base, long long power) {
  long long result = 1;
  while (power > 0) {
    if (power % 2 == 1) {
      result = (result * base) % 1000000007;
    }
    base = (base * base) % 1000000007;
    power = power / 2;
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long p = fast_power(2, n);
  cout << (p * (p + 1) / 2) % 1000000007;
  return 0;
}
