#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   long long f = 0, g = 1;   int n;   int main() {     cin >> n;     for (int i = 2; i <= n; i++) {       long long k = f;       f = 3 * g % mod;       g = (k + 2 * g) % mod;     }     printf( %lld , f);     return 0;   }   