#include <bits/stdc++.h>
using namespace std;
long long int usal(long long int x) {
  long long int k = 1;
  long long int o = 2;
  while (x > 0) {
    if (x & 1) k = (k * o % 1000000007) % 1000000007;
    x = x >> 1;
    o = (o * o) % 1000000007;
  }
  return k;
}
long long int toplam(long long int x) {
  long long int z = (x % 1000000007 * (x + 1LL) % 1000000007) % 1000000007;
  return (z / 2LL);
}
int main() {
  long long int n;
  cin >> n;
  if (n == 0) {
    cout << "1";
    return 0;
  }
  long long int a = (usal(n - 1) % 1000000007 + usal(2 * n - 1)) % 1000000007;
  a = a % 1000000007;
  cout << a << "\n";
  return 0;
}
