#include <bits/stdc++.h>
using namespace std;
long long bpow(long long a, long long b) {
  long long ans = 1;
  while (b != 0) {
    if (b & 1) {
      ans = (ans * a) % 1000000007;
    }
    a = (a * a) % 1000000007;
    b = b / 2;
  }
  return ans % 1000000007;
}
void solve() {
  long long n;
  cin >> n;
  if (n == 0) {
    cout << 1 << "\n";
    return;
  }
  long long ans = bpow(2, n);
  ans = ans % 1000000007;
  ans++;
  long long anss = bpow(2, n - 1);
  anss = anss % 1000000007;
  ans = ans * anss;
  ans = ans % 1000000007;
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
