#include <bits/stdc++.h>
using namespace std;
long long int M = 1000000000 + 7;
long long int power(long long int x, long long int n) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
long long int go(long long int n, long long int p) {
  if (n == 0 and p == 4) return 1;
  if (n <= 0) return 0;
  long long int r = 0;
  for (long long int i = 1; i <= 4; i++) {
    if (i != p) r += go(n - 1, i);
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a = 0, b = 0, c = 0, d = 1;
    for (long long int i = 1; i <= n; i++) {
      long long int p = b + c + d, q = a + c + d, r = a + b + d, s = a + b + c;
      a = p % M, b = q % M, c = r % M, d = s % M;
    }
    cout << d;
  }
  return 0;
}
