#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n;
long long powermod(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    n >>= 1;
  }
  return res;
}
signed main() {
  long long n;
  cin >> n;
  long long t = powermod(2, n);
  cout << t * (t + 1) / 2 % MOD << endl;
  return 0;
}
