#include <bits/stdc++.h>
using namespace std;
long long int bigmod(long long int a, long long int p, long long int m) {
  if (p == 0) {
    return 1;
  }
  if (p % 2 == 0) {
    long long int part = bigmod(a, p / 2, m);
    return (part * part) % m;
  } else if (p % 2 == 1) {
    long long int part = a % m;
    long long int partt = bigmod(a, p - 1, m);
    return (part * partt) % m;
  }
}
int main() {
  long long int a = 2, n, m = 1000000007;
  cin >> n;
  if (n == 0) {
    cout << 1 << endl;
    return 0;
  }
  long long int x, y, ans;
  x = bigmod(a, 2 * n - 1, m);
  y = bigmod(a, n - 1, m);
  ans = (x + y) % m;
  cout << ans << endl;
  return 0;
}
