#include <bits/stdc++.h>
using namespace std;
long long int get_n(long long int n) {
  if (n == 0) return 1;
  if (n == 1) return 2;
  long long tmp = get_n(n / 2) % 1000000007;
  tmp = (tmp * tmp) % 1000000007;
  if ((n / 2) * 2 != n) tmp = (tmp * 2) % 1000000007;
  return tmp;
}
int main() {
  long long int n, ans;
  cin >> n;
  if (n == 0) {
    printf("1\n");
    return 0;
  }
  ans = get_n(n - 1);
  ans = (ans + get_n(2 * n - 1)) % 1000000007;
  cout << ans << endl;
  return 0;
}
