#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long N = mod;
long long quick_mod(long long a, long long b) {
  long long ans = 1;
  a %= N;
  while (b) {
    if (b % 2 != 0) {
      ans = ans * a % N;
      b--;
    }
    b /= 2;
    a = a * a % N;
  }
  return ans % N;
}
int main() {
  long long m, n, i, j, k;
  while (cin >> m) {
    if (m == 0) {
      cout << 1 << endl;
      continue;
    }
    cout << (quick_mod(2, m - 1) * (1 + quick_mod(2, m))) % N << endl;
  }
}
