#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
const int mod = 1000003;
int n, m;
string str[MAXN];
int lp(int k) {
  bool f[2];
  f[0] = f[1] = false;
  for (int i = 0; i < m; i++) {
    if (str[k][i] == '1' || str[k][i] == '2') f[i % 2] = true;
    if (str[k][i] == '3' || str[k][i] == '4') f[1 - i % 2] = true;
  }
  if (f[0] && f[1]) return 0;
  if (f[0] || f[1]) return 1;
  return 2;
}
int cp(int k) {
  bool f[2];
  f[0] = f[1] = false;
  for (int i = 0; i < n; i++) {
    if (str[i][k] == '1' || str[i][k] == '4') f[i % 2] = true;
    if (str[i][k] == '3' || str[i][k] == '2') f[1 - i % 2] = true;
  }
  if (f[0] && f[1]) return 0;
  if (f[0] || f[1]) return 1;
  return 2;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> str[i];
  int ans = 1;
  for (int i = 0; i < n; i++) {
    ans *= lp(i);
    ans %= mod;
  }
  for (int i = 0; i < m; i++) {
    ans *= cp(i);
    ans %= mod;
  }
  cout << ans << '\n';
  return 0;
}
