M = [35.71 14.29 10.71 17.86 3.57 3.57 3.57 10.71]./100
P = M .* log2(1./M)
n = sum(P)
