#include <bits/stdc++.h>
const long long int oo = 2e18;
const int md = 1e9 + 7;
using namespace std;
long long int dp[10000001];
int n;
int main(void) {
  scanf("%d", &n);
  dp[0] = dp[1] = 0;
  for (int i = 2; i < 10000001; i++)
    dp[i] = ((dp[i - 1] + (i & 1 ? -1 : 1)) * 3) % md;
  printf("%lld\n", dp[n]);
  return 0;
}
