#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const double PI = 3.141592653589793;
const int mod = 1000000007;
long long n, k1, k2;
int poteguj(int a, long long b, int c) {
  int r = 1, m = a;
  while (b) {
    if (b % 2) r = (r * 1LL * m) % c;
    m = (m * 1LL * m) % c;
    b /= 2;
  }
  return r;
}
int main() {
  cin >> n;
  if (n == 0) {
    printf("1\n");
    return 0;
  }
  if (n == 1) {
    printf("3\n");
    return 0;
  }
  k1 = (1 + poteguj(2, n, mod)) % mod;
  k2 = poteguj(2, n - 1, mod);
  printf("%d\n", (k1 * 1LL * k2) % mod);
  return 0;
}
