#include <bits/stdc++.h>
using namespace std;
const int N = 1e8;
const int MOD = 1e9 + 7;
long long pow(long long a, long long b, long long MOD) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  if (n == 0)
    cout << 1 << "\n";
  else if (n == 1)
    cout << 3 << "\n";
  else
    cout << (pow(2, n - 1, MOD) + pow(2, 2 * n - 1, MOD)) % MOD << "\n";
}
