#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int k = 1;
  int m = (int)(1e9 + 7);
  while (k--) {
    int n;
    cin >> n;
    long long int a = 1, b = 0, temp1 = 0, temp2 = 0;
    for (int i = 1; i < n; i++) {
      temp1 = 2 * a + b;
      temp1 = temp1 % m;
      temp2 = 3 * a;
      temp2 = temp2 % m;
      a = temp1;
      b = temp2;
    }
    cout << b << "\n";
  }
  return 0;
}
