#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
long long bigmod(long long b, long long p, long long m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    long long temp = bigmod(b, p / 2, m);
    return (temp * temp) % m;
  }
  return (bigmod(b, p - 1, m) * (b % m)) % m;
}
int main() {
  long long n;
  cin >> n;
  if (n == 0) {
    cout << 1;
    return 0;
  }
  cout << (bigmod(2, n - 1, 1000000007) * (bigmod(2, n, 1000000007) + 1)) %
              1000000007;
}
