4050 X=NA*NB+NA*(NA+1)/2-S