#include <bits/stdc++.h>
using namespace std;
long long arr[10000001];
long long tem[10000001];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  arr[0] = arr[1] = 0;
  arr[2] = 3;
  tem[0] = tem[1] = 0;
  tem[2] = 9;
  long long temp = 1;
  for (int i = 3; i <= n; i++) {
    arr[i] = (tem[i - 2] + (6 * temp) % 1000000007) % 1000000007;
    tem[i] = ((tem[i - 1] * 2) % 1000000007 + (arr[i] * 3) % 1000000007) %
             1000000007;
    temp = (temp * 2) % 1000000007;
  }
  cout << arr[n];
  return 0;
}
