map int input split max t2 min for in range append for in range append

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
a,b = map(int,input().split())
t = max(a,b)
t2 = min(a,b)
c = []
for i in range(2):
c.append([])
for j in range(t):
c[i].append(1)
for i in range(t2):
for j in range(t):
if j + 1 <t:
c[1][j+1] = c[1][j]+c[0][j+1]
c[0],c[1]= c[1],c[0]
print(c[-1][-1]%1000007)