#include <bits/stdc++.h>
using namespace std;
int M = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<vector<int> > dp(5, vector<int>(n + 1, -1));
  dp[4][0] = 1;
  dp[1][0] = dp[2][0] = dp[3][0] = 0;
  for (int j = 1; j <= n; j++) {
    dp[1][j] = (((dp[2][j - 1] + dp[3][j - 1]) % M) + (dp[4][j - 1] % M)) % M;
    dp[2][j] = (((dp[1][j - 1] + dp[3][j - 1]) % M) + (dp[4][j - 1] % M)) % M;
    dp[3][j] = (((dp[2][j - 1] + dp[1][j - 1]) % M) + (dp[4][j - 1] % M)) % M;
    dp[4][j] = (((dp[2][j - 1] + dp[3][j - 1]) % M) + (dp[1][j - 1] % M)) % M;
  }
  cout << dp[4][n];
}
