#include <bits/stdc++.h>
const int INF = 1e9;
const int maxn = 50005;
const int mod = 1e9 + 7;
using namespace std;
inline long long read() {
  char ls;
  long long x = 0, sng = 1;
  for (; ls < '0' || ls > '9'; ls = getchar())
    if (ls == '-') sng = -1;
  for (; ls >= '0' && ls <= '9'; ls = getchar()) x = x * 10 + ls - '0';
  return x * sng;
}
struct kaga {
  long long a[2][2];
} one;
long long n;
kaga mul(kaga x, kaga y) {
  kaga tmp;
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j <= 1; j++) {
      tmp.a[i][j] = 0;
      for (int k = 0; k <= 1; k++) {
        tmp.a[i][j] += x.a[i][k] * y.a[k][j] % mod;
        tmp.a[i][j] %= mod;
      }
    }
  return tmp;
}
long long pw() {
  if (!n) return 1;
  kaga ans;
  ans.a[0][0] = 1;
  ans.a[0][1] = 0;
  ans.a[1][0] = 0;
  ans.a[1][1] = 1;
  for (; n; n >>= 1, one = mul(one, one))
    if (n & 1) ans = mul(one, ans);
  long long sum = 0;
  sum = (ans.a[0][0] + ans.a[0][1]) % mod;
  sum = (sum + mod) % mod;
  return sum % mod;
}
int main() {
  n = read();
  one.a[0][0] = 4;
  one.a[0][1] = -1;
  one.a[1][0] = 0;
  one.a[1][1] = 2;
  cout << pw();
}
