#include <bits/stdc++.h>
using namespace std;
int dp[5][10000040];
int main() {
  int n;
  cin >> n;
  dp[1][1] = 0;
  dp[2][1] = 0;
  dp[3][1] = 0;
  dp[4][1] = 1;
  for (int i = 2; i <= n; i++) {
    dp[1][i] = ((dp[2][i - 1] + dp[3][i - 1]) % 1000000007 + dp[4][i - 1]) %
               1000000007;
    dp[2][i] = ((dp[3][i - 1] + dp[4][i - 1]) % 1000000007 + dp[1][i - 1]) %
               1000000007;
    dp[3][i] = ((dp[1][i - 1] + dp[2][i - 1]) % 1000000007 + dp[4][i - 1]) %
               1000000007;
    dp[4][i] = ((dp[2][i - 1] + dp[3][i - 1]) % 1000000007 + dp[1][i - 1]) %
               1000000007;
  }
  cout << ((dp[1][n] + dp[2][n]) % 1000000007 + dp[3][n]) % 1000000007;
  return 0;
}
