#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long ans = 0, pow = 1;
  for (long long i = 1; i < n; i++) {
    pow = (3 * pow) % 1000000007;
    ans = (pow - ans) % 1000000007;
    if (ans < 0) ans += 1000000007;
  }
  cout << ans;
  return 0;
}
