#include <bits/stdc++.h>
using namespace std;
long long n, i, arr[10000100];
long long mod = 1e9 + 7;
int main() {
  arr[2] = 3;
  cin >> n;
  for (i = 3; i <= n; i++)
    if (i % 2 == 0)
      arr[i] = ((arr[i - 1] % mod) * 3 + 3) % mod;
    else
      arr[i] = ((arr[i - 1] % mod) * 3 - 3) % mod;
  cout << arr[n] << endl;
  return 0;
}
