func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   int mat[1000010];   int row(int r) {     int s = r * m, e = s + m;     bool eq = false, dif = false;     for (int i = s, idx = 0; i < e; i++, idx++) {       if (mat[i] == -1) continue;       int a = mat[i] / 2;       int b = idx & 1;       if (a == b) eq = true;       if (a != b) dif = true;     }     if (eq && dif) return 0;     if (eq || dif) return 1;     return 2;   }   int col(int c) {     int s = c, e = n * m + c;     bool eq = false, dif = false;     for (int i = s, idx = 0; i < e; i += m, idx++) {       if (mat[i] == -1) continue;       int a = min(mat[i], 3 - mat[i]);       int b = idx & 1;       if (a == b) eq = true;       if (a != b) dif = true;     }     if (eq && dif) return 0;     if (eq || dif) return 1;     return 2;   }   int main() {     while (cin >> n >> m) {       char ch;       for (int i = 0; i < n * m; i++) {         cin >> ch;         if (ch ==  . )           mat[i] = -1;         else           mat[i] = (int)(ch -  1 );       }       int res = 1;       for (int i = 0; i < n; i++) {         res *= row(i);         if (res >= 1000003) res -= 1000003;       }       for (int i = 0; i < m; i++) {         res *= col(i);         if (res >= 1000003) res -= 1000003;       }       cout << res % 1000003 << endl;     }     return 0;   }   