#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans, m, a;
  m = 1;
  a = 2;
  cin >> n;
  while (n) {
    if (n & 1) {
      m = (m * a) % 1000000007;
    }
    a = (a * a) % 1000000007;
    n = n >> 1;
  }
  ans = (m + 1) * m / 2;
  cout << ans % 1000000007 << endl;
}
