#include <bits/stdc++.h>
using namespace std;
long long pow(long long a, long long b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return pow((a * a) % 1000000007, b / 2) % 1000000007;
  else
    return (a * pow((a * a) % 1000000007, b / 2)) % 1000000007;
}
int main() {
  long long n;
  cin >> n;
  if (!n) {
    cout << 1;
    return 0;
  }
  long long ans = pow(2ll, n - 1ll), x = (ans) * (2ll) + 1ll;
  x %= 1000000007;
  ans = (ans * x) % 1000000007;
  cout << ans;
  return 0;
}
