#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007ll;
long long n, ans;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  long long ret = power(a, b >> 1);
  (ret *= ret) %= mod;
  if (b & 1) (ret *= a) %= mod;
  return ret;
}
int main() {
  cin >> n;
  ans = power(2, n);
  cout << ans * (ans + 1) % mod * 500000004ll % mod << endl;
  ;
  return 0;
}
