#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n;     cin >> n;     int zD = 1;     int zABC = 0;     for (int i = 1; i <= n; i++) {       int nzD = zABC * 3LL % 1000000007;       int nzABC = (zABC * 2LL + zD) % 1000000007;       zD = nzD;       zABC = nzABC;     }     cout << zD;     return 0;   }   