注意!格子数和顶点数字不一样!需+1
def matrix(s):
l=s.split() #将字符串分解为一个含有两个整字符的列表
n=int(l[0])+1
m=int(l[1])+1
num=[[0 for i in range(m)] for i in range(n)]
#初始化
for i in range(n):
for j in range(m):
num[i][0]=1
num[0][j]=1
#状态转移方程 AKA 递推式
for i in range(1,n):
for j in range(1,m):
num[i][j]=num[i-1][j]+num[i][j-1]
return num[n-1][m-1]
while 1:
try:
print(matrix(input()))
except:
break