#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
int modexp(long long x, long long y) {
  int ans = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) ans = (ans * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long ans = (modexp(4, n) + modexp(2, n)) % 1000000007;
  ans = (ans * modexp(2, 1000000007 - 2)) % 1000000007;
  cout << ans;
  return 0;
}
