#include <bits/stdc++.h>
using namespace std;
int testnum;
vector<vector<int> > arr;
vector<int> row;
vector<int> col;
int n, m;
void preprocess() {}
void solve() {
  row.resize(n);
  col.resize(m);
  for (int i = 0; i < n; i++) row[i] = 0;
  for (int j = 0; j < m; j++) col[j] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (arr[i][j] > 0) {
        row[i] = 1;
        col[j] = 1;
      }
  for (int i = 0; i < n; i++) {
    if (row[i] == 0) continue;
    int mode1 = 0;
    int mode2 = 0;
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == 0) continue;
      if (arr[i][j] == 1 || arr[i][j] == 2) {
        if (j & 1)
          mode1 = 1;
        else
          mode2 = 1;
      } else {
        if (j & 1)
          mode2 = 1;
        else
          mode1 = 1;
      }
    }
    if (mode1 == 1 && mode2 == 1) {
      cout << 0 << endl;
      return;
    }
  }
  for (int j = 0; j < m; j++) {
    if (col[j] == 0) continue;
    int mode1 = 0;
    int mode2 = 0;
    for (int i = 0; i < n; i++) {
      if (arr[i][j] == 0) continue;
      if (arr[i][j] == 2 || arr[i][j] == 3) {
        if (i & 1)
          mode1 = 1;
        else
          mode2 = 1;
      } else {
        if (i & 1)
          mode2 = 1;
        else
          mode1 = 1;
      }
    }
    if (mode1 == 1 && mode2 == 1) {
      cout << 0 << endl;
      return;
    }
  }
  int rl = 0, cl = 0;
  for (int i = 0; i < n; i++)
    if (row[i] == 0) rl++;
  for (int j = 0; j < m; j++)
    if (col[j] == 0) cl++;
  int p = rl + cl;
  long long ans = 1;
  long long x = 2;
  long long mod = 1000003;
  while (p > 0) {
    if (p & 1) ans = (ans * x) % mod;
    x = (x * x) % mod;
    p >>= 1;
  }
  cout << ans << endl;
}
bool input() {
  scanf("%d", &n);
  scanf("%d", &m);
  arr.clear();
  arr.resize(n);
  char temp[500005];
  for (int i = 0; i < n; i++) {
    arr[i].resize(m);
    scanf("%s", temp);
    for (int j = 0; j < m; j++) {
      if (temp[j] == '.')
        arr[i][j] = 0;
      else
        arr[i][j] = temp[j] - '0';
    }
  }
  return true;
}
int main() {
  preprocess();
  int T = 1;
  for (testnum = 1; testnum <= T; testnum++) {
    if (!input()) break;
    solve();
  }
}
