def binomial(n, p): if n==p or p==0: return 1 else: return binomial(n-1,p-1)*n//p