#include <bits/stdc++.h>
const long long inf = 1e9;
const long long zero = 0;
const long long MOD = 1e9 + 7;
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long abc = 0, d = 1, tabc, td;
  for (int i = 0; i < n; i++) {
    td = (abc * 3) % MOD;
    tabc = (abc * 2 + d) % MOD;
    d = td;
    abc = tabc;
  }
  cout << td;
}
