#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
const int mod = 1000003;
int row[1111111];
int col[1111111];
int main() {
  int n, m;
  char c;
  cin >> n >> m;
  for (int i(0); i < (n); i++) {
    for (int j(0); j < (m); j++) {
      scanf(" %c", &c);
      if (c == '.') continue;
      if (c == '1' || c == '2')
        row[i] |= 1 << (j % 2);
      else
        row[i] |= 1 << (1 - j % 2);
      if (c == '1' || c == '4')
        col[j] |= 1 << (i % 2);
      else
        col[j] |= 1 << (1 - i % 2);
    }
  }
  for (int i(0); i < (n); i++)
    if (row[i] == 3) {
      puts("0");
      return 0;
    }
  for (int i(0); i < (m); i++)
    if (col[i] == 3) {
      puts("0");
      return 0;
    }
  int cc = 0;
  for (int i(0); i < (n); i++)
    if (row[i] == 0) cc++;
  for (int i(0); i < (m); i++)
    if (col[i] == 0) cc++;
  int res = 1;
  while (cc) {
    res *= 2;
    cc--;
    res %= mod;
  }
  cout << res << endl;
  return 0;
}
