#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  int b = 0;
  for (const auto& a : v) o << (b++ ? " " : "") << a;
  return o;
}
long long last[4];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  last[0] = 1;
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    long long a = last[1] + last[2] + last[3];
    long long b = last[0] + last[2] + last[3];
    long long c = last[0] + last[1] + last[3];
    long long d = last[0] + last[1] + last[2];
    last[0] = a % 1000000007;
    last[1] = b % 1000000007;
    last[2] = c % 1000000007;
    last[3] = d % 1000000007;
  }
  cout << last[0] << endl;
  return 0;
}
