#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e7 + 2;
const int MAXR = 1;
const int MAXC = 1;
const int INF = (int)1e9;
priority_queue<int, vector<int>, greater<int>> q1;
priority_queue<int, vector<int>, less<int>> q2;
long long int dp[MAXN][2];
int x4[] = {-1, 0, 1, 0};
int y4[] = {0, 1, 0, -1};
long long int rm(long long int i) { return i % 1000000007; }
int main(void) {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  dp[0][0] = 0;
  dp[0][1] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = rm(rm(dp[i - 1][0] * 2) + dp[i - 1][1]);
    dp[i][1] = rm(dp[i - 1][0] * 3);
  }
  cout << dp[n][1];
  return 0;
}
