https://www.acmicpc.net/problem/11051
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
# 파스칼의 삼각형 이용
#dp[n][k] = nCk
dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(1, n+1):
for j in range(0, n+1):
if j == 0 or j == i:
dp[i][j] = 1
continue
dp[i][j] = (dp[i-1][j-1] + dp[i-1][j]) % 10007
print(dp[n][k])
dp =
[[1, 0, 0, 0, 0, 0]
[1, 1, 0, 0, 0, 0]
[1, 2, 1, 0, 0, 0]
[1, 3, 3, 1, 0, 0]
[1, 4, 6, 4, 1, 0]
[1, 5, 10, 10, 5, 1]]