#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long mod_pow(long long x, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
typedef struct node {
  long long edge[3][3];
} Matrix;
long long n, m = 10000;
Matrix mz, ant, h;
void Mult(Matrix &a, Matrix &b, Matrix &c) {
  int i, j, k;
  memset(h.edge, 0, sizeof(h.edge));
  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++)
      for (k = 0; k < 2; k++) {
        h.edge[i][j] += a.edge[i][k] * b.edge[k][j];
        h.edge[i][j] %= mod;
      }
  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++) c.edge[i][j] = h.edge[i][j];
}
void KSM(Matrix a, long long k) {
  while (k >= 1) {
    if (k & 1) Mult(ant, mz, ant);
    Mult(mz, mz, mz);
    k >>= 1;
  }
}
int main() {
  cin >> n;
  {
    mz.edge[0][0] = 2;
    mz.edge[0][1] = 0;
    mz.edge[1][0] = 4;
    mz.edge[1][1] = 4;
    ant.edge[0][0] = 10;
    ant.edge[0][1] = 4;
    if (n == 0)
      cout << 1 << endl;
    else if (n == 1)
      cout << 3 << endl;
    else if (n == 2)
      cout << 10 << endl;
    else {
      KSM(ant, n - 2);
      cout << ant.edge[0][0];
    }
  }
  return 0;
}
