#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long pw(long long a, long long p) {
  if (p == 1) return a;
  if (p == 0) return 1;
  long long ret = pw(a, p / 2) % 1000000007;
  ret = (ret * ret) % 1000000007;
  if (p % 2 == 1) ret = (ret * a) % 1000000007;
  return ret;
}
int main() {
  long long n, y;
  cin >> n;
  y = pw(2LL, n);
  cout << (y * (y + 1) / 2) % 1000000007;
}
