#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int MOD = 1000000007;
void solve() {
  int n;
  cin >> n;
  long long x2 = 1, x1 = 0, a, b;
  for (int i = 1; i <= n; i++) {
    a = (2 * x1 + x2) % MOD;
    b = (3 * x1) % MOD;
    x1 = a;
    x2 = b;
  }
  cout << x2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
