#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500100, MOD = 1000003;
string str[MAXN];
int main() {
  int R, C;
  cin >> R >> C;
  for (int i = 0; i < R; i++) cin >> str[i];
  int ans = 1;
  for (int i = 0; i < R; i++) {
    bool bad[2] = {false, false};
    for (int j = 0, m = 0; j < C; j++, m ^= 1) {
      if (str[i][j] == '.') continue;
      bool left = str[i][j] == '1' || str[i][j] == '2';
      bad[m] |= !left;
      bad[m ^ 1] |= left;
    }
    int cnt = (!bad[0]) + (!bad[1]);
    ans = ans * cnt % MOD;
  }
  for (int i = 0; i < C; i++) {
    bool bad[2] = {false, false};
    for (int j = 0, m = 0; j < R; j++, m ^= 1) {
      if (str[j][i] == '.') continue;
      bool upper = str[j][i] == '1' || str[j][i] == '4';
      bad[m] |= !upper;
      bad[m ^ 1] |= upper;
    }
    int cnt = (!bad[0]) + (!bad[1]);
    ans = ans * cnt % MOD;
  }
  printf("%d\n", ans);
  return 0;
}
