#include <bits/stdc++.h>
long long int power(long long int x, long long int b) {
  long long int p = 1;
  while (b > 0) {
    if (b & 1) {
      p = p * x;
      p %= 1000000007;
    }
    b >>= 1;
    x *= x;
    x %= 1000000007;
  }
  return p % 1000000007;
}
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int sum = 0;
  sum = power(2LL, n);
  sum = sum * (sum + 1LL);
  sum %= 1000000007;
  sum = sum * power(2LL, 1000000007 - 2);
  sum %= 1000000007;
  cout << sum << "\n";
  return 0;
}
