#include <bits/stdc++.h>
using namespace std;
long long x = 1e9 + 7, n, a = 1, b = 2;
int main() {
  cin >> n;
  while (n) {
    if (n % 2) a = (a * b) % x;
    n /= 2;
    b = (b * b) % x;
  }
  cout << ((a * a + a) / 2) % x;
  return 0;
}
