func_code_string: #include <bits/stdc++.h>   using namespace std;   int Q, N, M, K, L;   bool board[10001][3];   long long dp[10001][8];   int bitCheck[4][2][2] = {       {{-2, 0}, {-1, 0}}, {{1, 0}, {2, 0}}, {{0, 1}, {0, 2}}, {{0, -1}, {0, -2}}};   void getNextStates(int n, int m, int thisState, int nextState,                      vector<int>& res) {     if (m == 3) {       res.push_back(nextState);       return;     }     if (board[n][m] || (thisState & (1 << m))) {       getNextStates(n, m + 1, thisState, nextState, res);       return;     }     if (n < N - 1) {       if (!board[n + 1][m])         getNextStates(n, m + 1, thisState, nextState | (1 << m), res);     }     if (m < 2) {       if (!board[n][m + 1] && !(thisState & (1 << (m + 1))))         getNextStates(n, m + 2, thisState, nextState, res);     }   }   long long solve(int n, int state) {     if (n == N) {       return 1LL;     }     long long& ret = dp[n][state];     if (~ret) return ret;     ret = 0;     vector<int> next;     getNextStates(n, 0, state, 0, next);     for (int i = 0; i < next.size(); i++) {       ret += solve(n + 1, next[i]);       ret %= 1000000007LL;     }     return ret;   }   int x, y;   long long ret;   void solve2(int n, int cnt) {     if (n == 4) {       if (!cnt) return;       memset(dp, -1, sizeof dp);       long long t = solve(0, 0);       if (cnt % 2)         ret += t;       else         ret -= t;       ret = (ret + 1000000007LL) % 1000000007LL;       return;     }     solve2(n + 1, cnt);     bool flag = true;     for (int j = 0; j < 2; j++) {       int nx = x + bitCheck[n][j][0];       int ny = y + bitCheck[n][j][1];       if (nx < 0 || ny < 0 || nx >= N || ny >= 3 || board[nx][ny]) flag = false;     }     if (!flag) return;     for (int j = 0; j < 2; j++) {       int nx = x + bitCheck[n][j][0];       int ny = y + bitCheck[n][j][1];       board[nx][ny] = 1;     }     solve2(n + 1, cnt + 1);     for (int j = 0; j < 2; j++) {       int nx = x + bitCheck[n][j][0];       int ny = y + bitCheck[n][j][1];       board[nx][ny] = 0;     }   }   int main() {     cin >> N;     board[N][0] = board[N][1] = board[N][2] = 1;     for (int i = 0; i < 3; i++) {       string s;       cin >> s;       for (int j = 0; j < N; j++) {         board[j][i] = s[j] ==  .  ? false : true;         if (s[j] ==  O ) {           y = i;           x = j;         }       }     }     solve2(0, 0);     cout << ret;     cin >> N;   }   