#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int MAXN = 1e7 + 10;
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  long long a = 1, b = 0, c = 0;
  for (int i = 2; i <= n; i++) {
    c = (2 * b + 3 * a) % mod;
    a = b;
    b = c;
  }
  cout << c << '\n';
  return 0;
}
