import sys import itertools read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines H, W = map(int, readline().split()) readline() P = [] for _ in range(H): P += [0.0] + [0.01 * int(x) for x in readline().split()] readline() S = [] for _ in range(H): S += [4] + list(map(int, readline().split())) W += 1 # (bit列, n) = (挙手の状態, リーチ目人数) に対して確率を持つ dp = [0.0] * (W * (1 << W)) dp[0] = 1.0 mask = (1 << W) - 1 answer = 0 for p, s in zip(P, S): newdp = [0.0] * (W * (1 << W)) for i in range(W * (1 << W)): if dp[i] == 0.0: continue bit, n = divmod(i, W) # 無知 bit1 = (bit << 1) & mask newdp[bit1 * W] += dp[i] * (1 - p) # 知 s1 = s - (bit & 1) - (bit >> W - 1) if s1 > 1: # 挙手しない確定 newdp[bit1 * W] += dp[i] * p elif s1 == 1: # リーチ目に 1 人追加 newdp[bit1 * W + n + 1] += dp[i] * p else: # 挙手する確定 answer += (n + 1) * dp[i] * p bit1 |= (1 << n + 1) - 1 newdp[bit1 * W] += dp[i] * p dp = newdp print(answer)