#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
const int ST = 100010;
const int ST1 = 1000010;
const long long MOD = 1000000007;
long long ABS(long long a) {
  if (a < 0)
    return a * (-1);
  else
    return a;
}
long long binpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res *= a;
    a *= a;
    n >>= 1;
    a = a % MOD;
    res = res % MOD;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  long long k = binpow(2, n);
  long long ans = ((1 + k) * k / 2) % MOD;
  cout << ans;
}
