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