#include <bits/stdc++.h>
using namespace std;
long long int f[10000010], g[10000010];
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  f[0] = 1;
  f[1] = 0;
  g[0] = 0;
  g[1] = 3;
  for (int i = 2; i <= n; i++) {
    g[i] = (7 * g[i - 2] + 6 * f[i - 2]) % mod;
    f[i] = (3 * f[i - 2] + 2 * g[i - 2]) % mod;
  }
  cout << f[n] << endl;
  cin >> n;
  return 0;
}
