#include<iostream> #include<cstdio> usingnamespace std; constint N = 5e3 + 10, mod = 1e8; bool avai[15][15]; int m, n, cnt[15], state[15][N], f[15][N]; intmain() { cin >> m >> n; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) cin >> avai[i][j]; for (int k = 0; k < m; k++) for (int i = 0; i < 1 << n; i++) { bool flag = true; for (int j = 0; j < n; j++) if (((i >> j & 1) & (i >> j + 1 & 1)) || (!avai[k][j] && i >> j & 1)) { flag = false; break; } if (flag) state[k][++cnt[k]] = i; } for (int i = 1; i <= cnt[0]; i++) f[0][i] = 1; for (int i = 1; i < m; i++) for (int x = 1; x <= cnt[i]; x++) for (int y = 1; y <= cnt[i - 1]; y++) if ((state[i][x] & state[i - 1][y]) == 0) f[i][x] = (f[i][x] + f[i - 1][y]) % mod; int res = 0; for (int i = 0; i < 1 << n; i++) res = (res + f[m - 1][i]) % mod; cout << res; return0; }