#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500000;
char d[2 * MAXN + 10];
char *c[MAXN + 10];
int left(char x) { return x == '1' || x == '2'; }
int up(char x) { return x == '1' || x == '4'; }
const int MOD = 1000003;
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); ++i) {
    c[i] = d + i * (m + 1);
    scanf("%s", c[i]);
  }
  int res = 1;
  for (int i = 0; i < (n); ++i) {
    int cnt = 0;
    for (int k = 0; k < (2); ++k) {
      bool ok = true;
      for (int j = 0; j < (m); ++j) {
        if (c[i][j] != '.' && !(left(c[i][j]) ^ k ^ (j % 2))) {
          ok = false;
        }
      }
      if (ok) {
        ++cnt;
      }
    }
    res = (res * cnt) % MOD;
  }
  for (int j = 0; j < (m); ++j) {
    int cnt = 0;
    for (int k = 0; k < (2); ++k) {
      bool ok = true;
      for (int i = 0; i < (n); ++i) {
        if (c[i][j] != '.' && !(up(c[i][j]) ^ k ^ (i % 2))) {
          ok = false;
        }
      }
      if (ok) {
        ++cnt;
      }
    }
    res = (res * cnt) % MOD;
  }
  printf("%d\n", res);
  return 0;
}
