#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000, mod = 1000003;
string a[maxn];
void NO(void) {
  cout << 0 << endl;
  exit(0);
}
int main() {
  int n, m;
  cin >> m >> n;
  for (int i = 0; i < m; i++) cin >> a[i];
  vector<int> row(m, 0), col(n, 0);
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++)
      if (a[i][j] != '.') {
        int cur = a[i][j] - '1';
        row[i] |= 1 << ((cur / 2 + j) % 2);
        col[j] |= 1 << ((i + __builtin_popcount(cur)) % 2);
        if (row[i] == 3 || col[j] == 3) {
          cout << 0 << endl;
          return 0;
        }
      }
  int t = 0, ans = 1;
  for (int i = 0; i < m; i++) {
    bool k = true;
    for (int j = 0; j < n; j++)
      if (a[i][j] != '.') {
        k = false;
        break;
      }
    if (k) t++;
  }
  for (int j = 0; j < n; j++) {
    bool k = true;
    for (int i = 0; i < m; i++)
      if (a[i][j] != '.') {
        k = false;
        break;
      }
    if (k) t++;
  }
  while (t--) {
    ans *= 2;
    ans %= mod;
  }
  cout << ans << endl;
}
