#include <bits/stdc++.h>
using namespace std;
long long n, ans, k;
const long long mo = 1e9 + 7;
long long ksm(long long x, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) res = (res * x) % mo;
    x = (x * x) % mo;
    p >>= 1;
  }
  return res;
}
signed main() {
  cin >> n;
  k = ksm(2, n);
  cout << ((1 + k) * k / 2) % mo;
}
