#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  long long x, y;
  x = 1;
  y = 0;
  for (int i = 0; i < n; i++) {
    long long newx, newy;
    newx = y;
    newy = 3 * x + 2 * y;
    x = newx;
    y = newy;
    x %= MOD;
    y %= MOD;
  }
  cout << x << endl;
  return 0;
}
