edited multinomial.cpp