#include <bits/stdc++.h>
using namespace std;
long long int bin(long long int a, long long int n) {
  if (n == 0) {
    return 1;
  }
  if (n % 2 == 0) {
    a = bin(a, n / 2) % 1000000007;
    return a * a % 1000000007;
  }
  if (n % 2 != 0) {
    long long int tmp = a % 1000000007;
    a = bin(a, (n - 1) / 2) % 1000000007;
    return a * a * tmp % 1000000007;
  }
}
int main(int argc, char** argv) {
  long double n;
  cin >> n;
  long long int a;
  long long int t = bin(2, n);
  a = (1 + t) * t / 2 % 1000000007;
  cout << a << endl;
  return 0;
}
