#include <bits/stdc++.h>
using namespace std;
string s[500000];
const int mod = 1000003;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> s[i];
  int result = 1;
  for (int i = 0; i < n; i++) {
    bool ok1 = false, ok2 = false;
    for (int j = 0; j < m; j++) {
      if (j % 2 == 0 && (s[i][j] == '1' || s[i][j] == '2')) ok1 = true;
      if (j % 2 == 1 && (s[i][j] == '3' || s[i][j] == '4')) ok1 = true;
      if (j % 2 == 1 && (s[i][j] == '1' || s[i][j] == '2')) ok2 = true;
      if (j % 2 == 0 && (s[i][j] == '3' || s[i][j] == '4')) ok2 = true;
    }
    if (ok1 && ok2) result *= 0;
    if (!ok1 && !ok2) result = (result * 2) % mod;
  }
  for (int j = 0; j < m; j++) {
    bool ok1 = false, ok2 = false;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0 && (s[i][j] == '4' || s[i][j] == '1')) ok1 = true;
      if (i % 2 == 1 && (s[i][j] == '2' || s[i][j] == '3')) ok1 = true;
      if (i % 2 == 1 && (s[i][j] == '4' || s[i][j] == '1')) ok2 = true;
      if (i % 2 == 0 && (s[i][j] == '2' || s[i][j] == '3')) ok2 = true;
    }
    if (ok1 && ok2) result *= 0;
    if (!ok1 && !ok2) result = (result * 2) % mod;
  }
  cout << result;
}
