#include <bits/stdc++.h>
using namespace std;
int inf = 2147483647;
const long long ll = 9223372036854775807, ninf = 1000000000;
const double eps = 1e-6;
const long long nll = 223372036854775807;
int mod = 1000000007;
long long pow(long long n) {
  if (n == 0) return 1;
  long long x = pow(n / 2);
  x *= x;
  x %= mod;
  if (n % 2) x *= 2;
  x %= mod;
  return x;
}
int main() {
  long long a;
  while (cin >> a) {
    long long n = pow(a);
    cout << (n * (n + 1)) / 2 % mod << '\n';
  }
  return 0;
}
