#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
using namespace std::chrono;
long long exp(long long x, long long y, long long p) {
  x %= p;
  long long res = 1;
  while (y) {
    if (y % 2) res = (res * x % p) % p;
    x = (x * x) % p;
    y /= 2;
  }
  return res;
}
long long expo(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y % 2) res = (res * x % 1000000007) % 1000000007;
    x = (x * x) % 1000000007;
    y /= 2;
  }
  return res;
}
long long add(long long a, long long b) {
  return (a % 1000000007 + b % 1000000007 + 1000000007) % 1000000007;
}
long long sub(long long a, long long b) {
  return (a % 1000000007 - b % 1000000007 + 1000000007) % 1000000007;
}
long long mul(long long a, long long b) {
  return ((a % 1000000007) * (b % 1000000007) + 1000000007) % 1000000007;
}
long long inv(long long x) { return expo(x, 1000000007 - 2); }
void timelap();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long n;
  cin >> n;
  long long dp[4];
  dp[0] = 1;
  dp[1] = 1;
  dp[2] = 1;
  dp[3] = 0;
  if (n == 1)
    cout << 0;
  else {
    long long a, b, c, d;
    for (int i = 0; i < n - 1; i++) {
      a = (dp[1] + dp[2] + dp[3]) % 1000000007;
      b = (dp[0] + dp[2] + dp[3]) % 1000000007;
      c = (dp[0] + dp[1] + dp[3]) % 1000000007;
      d = (dp[0] + dp[1] + dp[2]) % 1000000007;
      dp[0] = a;
      dp[1] = b;
      dp[2] = c;
      dp[3] = d;
    }
    cout << dp[3] % 1000000007;
  }
  timelap();
  return 0;
}
void timelap() {}
