#include <bits/stdc++.h>
using namespace std;
const int MAX = 10001;
const int mod = 1000000007;
long long n;
long long fun(long long k, long long b) {
  long long a = 1;
  while (k) {
    if (k & 1) {
      a = (a * b) % mod;
    }
    b = (b * b) % mod;
    k >>= 1;
  }
  return a;
}
void solve() {
  if (n == 0) {
    puts("1");
    return;
  }
  printf("%I64d\n", (fun(n - 1, 2) + 2 * fun(n - 1, 4)) % mod);
}
int main() {
  while (cin >> n) {
    solve();
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
