#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
inline long long read() {
  char c = getchar();
  long long x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
long long N, K;
long long mul(long long a, long long b) { return 1ll * a * b % mod; }
long long fp(long long a, long long p) {
  long long base = 1;
  while (p) {
    if (p & 1) base = mul(base, a);
    a = mul(a, a);
    p >>= 1;
  }
  return base;
}
signed main() {
  long long N = read();
  N++;
  long long inv2 = fp(2, mod - 2);
  cout << mul(mul(fp(2, N - 1), inv2), (1 + fp(2, N - 1)) % mod);
  return 0;
}
