#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using dl = double;
using ull = unsigned long long;
const long N = 3e5 + 10;
ll aarray[N];
ll magic[510][510];
vector<ll> primes;
bool check[1000001];
ll vis[N];
map<ll, ll> mp;
ll ans[10000005];
void v() {
  ans[2] = 3;
  ans[3] = 6;
  ll n = 6;
  for (ll i = 4; i <= 10000005; i++) {
    n *= 3;
    n %= 1000000007;
    ans[i] = ((n % 1000000007) + (ans[i - 2] % 1000000007)) % 1000000007;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string str;
  ll i, j, n, m, k, t;
  cin >> n;
  v();
  cout << ans[n] << "\n";
  return 0;
}
