#include <bits/stdc++.h>
long long binpon(long long b) {
  long long a = 2;
  long long res = 1 % 1000000007;
  while (b) {
    if (b % 2 == 0) {
      b >>= 1;
      a = a * a % 1000000007;
    } else {
      b--;
      res = res * a % 1000000007;
    }
  }
  return res % 1000000007;
}
using namespace std;
int main() {
  long long b, res, res2;
  cin >> b;
  res = binpon(b);
  res2 = res * (res + 1) / 2;
  cout << res2 % 1000000007;
  return 0;
}
