#include <bits/stdc++.h>
using namespace std;
unsigned long long n, res;
long long fast_power(long long base, long long power) {
  if (power == 0) {
    return 1;
  }
  long long ans = fast_power(base, power / 2) % 1000000007;
  ans *= ans % 1000000007;
  if (power % 2) {
    ans *= base % 1000000007;
  }
  return ans % 1000000007;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  res = fast_power(2, n);
  cout << ((res * (res + 1)) / 2) % 1000000007;
}
