#include "bits/stdc++.h" #include #pragma warning(disable:4996) using namespace std; using ld = long double; template using Table = vector>; ld pers[11][11]; int shys[11][11]; vector>hands; int main() { int R, C; cin >> R >> C; hands.resize(R+1); for (int i = 0; i < hands.size(); ++i){ hands[i].resize(1 << C); } for (int i = 0; i < R; ++i){ for (int j = 0; j < C; ++j){ cin >> pers[i][j]; pers[i][j] /= 100; } } for (int i = 0; i < R; ++i){ for (int j = 0; j < C; ++j){ cin >> shys[i][j]; } } for (int i = 0; i < (1 << C); ++i){ hands[0][i] = 0; } hands[0][0] = 1; ld ans = 0; for (int r = 1; r <= R; ++r){ for (int l = 0; l < (1 << C); ++l){ const bitset<11> knows(l); vectorpoints(C); ld percentage = 1; for (int i = 0; i < C; ++i){ if (knows[i]){ points[i] += 4 - shys[r - 1][i]; percentage *= pers[r - 1][i]; } else{ percentage *= 1 - pers[r - 1][i]; } } for (int k = 0; k < (1 << C); ++k){ if (hands[r - 1][k] < 1e-11)continue; vectornpoints(points); const bitset<11>prehands(k); bitset<11>ups(0); for (int i = 0; i < C; ++i){ if (prehands[i]){ npoints[i] ++; } } for (int i = 0; i < C; ++i){ if (npoints[i] >= 4){ ups[i] = true; if (i != C - 1)npoints[i + 1] ++; } } for (int i = C-1; i >=0; --i){ if (npoints[i] >= 4){ ups[i] = true; if (i != 0)npoints[i - 1]++; } } hands[r][ups.to_ulong()] += percentage*hands[r - 1][k]; ans += percentage*hands[r - 1][k] * ups.count(); } } } cout <