#include <bits/stdc++.h>
using namespace std;
int fa[10009090], fb[10009090], fc[10909090], fd[10909090], n;
int main() {
  cin >> n;
  fa[1] = 1;
  fb[1] = 1;
  fd[1] = 0;
  fc[1] = 1;
  for (int i = 2; i <= n; i++) {
    fa[i] = ((fb[i - 1] + fc[i - 1]) % 1000000007 + fd[i - 1]) % 1000000007;
    fb[i] = ((fa[i - 1] + fc[i - 1]) % 1000000007 + fd[i - 1]) % 1000000007;
    fc[i] = ((fb[i - 1] + fa[i - 1]) % 1000000007 + fd[i - 1]) % 1000000007;
    fd[i] = ((fb[i - 1] + fc[i - 1]) % 1000000007 + fa[i - 1]) % 1000000007;
  }
  cout << fd[n];
}
