#include <bits/stdc++.h>
using namespace std;
int m = 1000000007;
long long fast_pow(long long a, long long p) {
  long long res = 1;
  while (p) {
    if (p % 2 == 0) {
      a = (a * a) % 1000000007;
      p /= 2;
    } else {
      res = (res * a) % 1000000007;
      p--;
    }
  }
  return res;
}
inline void solve() {
  long long x;
  scanf("%I64d", &x);
  if (x == 0) {
    puts("1");
    return;
  }
  cout << (fast_pow(2, x - 1) + 2ll * fast_pow(4, x - 1)) % 1000000007;
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
