sum(k*binomial(n,k)*p^k*(1-p)^(n-k),{k,0,n})