def solution(m, n, puddles):
answer = 0
maps = []
for i in range(n):
maps.append([1]*m)
for pu in puddles:
maps[pu[1]-1][pu[0]-1] = 0 #앗쒸.. 3번째 열 2번째 행이었냐..
# 0행/0열에 물웅덩이 있으면 그 뒤로는 못감
for i in range(m):
if maps[0][i] == 0:
for j in range(i+1, m):
maps[0][j] = 0
break
for i in range(n):
if maps[i][0] == 0:
for j in range(i+1, n):
maps[j][0] = 0
break
for i in range(1,n):
for j in range(1,m):
if maps[i][j]!=0:
maps[i][j] = (maps[i-1][j] + maps[i][j-1])
answer = maps[-1][-1]
return answer%1000000007