#include <bits/stdc++.h>
using namespace std;
long long INF = 1000000007;
long long n, k, v, z, i, c, d, fl, s, a;
long long as(long long x) {
  if (x < 0)
    return -x;
  else
    return x;
}
int main() {
  cin >> n;
  a = 0;
  s = 1;
  for (i = 0; i < n - 1; i++) {
    s = (s * 3) % INF;
    a = s - a;
    a = (a + INF) % INF;
  }
  cout << a;
  return 0;
}
