#include <bits/stdc++.h>
using namespace std;
unsigned long long bin_pow(unsigned long long a, unsigned long long p) {
  unsigned long long res = 1;
  while (p) {
    if (p & 1) res *= a;
    a *= a;
    p >>= 1;
    res %= 1000000007;
    a %= 1000000007;
  }
  return res;
}
int binpow(int a, int n) {}
int main() {
  unsigned long long n;
  cin >> n;
  if (n == 0) {
    cout << 1 << endl;
    return 0;
  }
  unsigned long long r = bin_pow(2, ((n << 1) - 1));
  unsigned long long s = bin_pow(2, n - 1);
  r += s;
  r %= 1000000007;
  cout << r << endl;
  return 0;
}
