#include <bits/stdc++.h>
using namespace std;
long long rem = 1e9 + 7;
long long binExp(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res *= x;
      res %= rem;
    }
    n /= 2;
    x *= x;
    x %= rem;
  }
  return res;
}
void solve() {
  long long n;
  cin >> n;
  long long x = binExp(2, n);
  long long temp1 = x * (x + 1);
  temp1 %= rem;
  long long temp2 = binExp(2, rem - 2);
  temp1 *= temp2;
  temp1 %= rem;
  cout << temp1;
}
int32_t main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
