pythondef solve(H, W, data):
score = [[0] * (W + 1) for i in range(H + 1)]
score[0][1] = 1
for y in range(1, H + 1):
for x in range(1, W + 1):
if data[y - 1][x - 1] == ord("#"):
score[y][x] = 0
else:
score[y][x] = (score[y - 1][x] + score[y][x - 1]) % MOD
return score[H][W]