#include <bits/stdc++.h>
using namespace std;
long long qpow(long long x) {
  if (x == 0)
    return 1;
  else if (x % 2 == 0) {
    long long tmp = qpow(x / 2) % 1000000007;
    return tmp * tmp;
  } else {
    long long tmp = qpow(x / 2) % 1000000007;
    return 2 * tmp * tmp;
  }
}
int main() {
  long long n, ans = 0;
  cin >> n;
  long long t = qpow(n) % 1000000007;
  cout << (t * (t + 1) / 2) % 1000000007 << endl;
}
