#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
long long int n;
long long int exp_mod(long long int a, long long int b) {
  long long int ret = 1;
  a = a % MOD;
  while (b) {
    if (b & 1) ret = (a * ret) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return ret;
}
int main(void) {
  ios_base::sync_with_stdio(0);
  while (cin >> n) {
    n = exp_mod(2, n);
    long long int ans = (n * (1 + n) / 2) % MOD;
    cout << ans << endl;
  }
  return 0;
}
