calculating sum3 which gives the final answer m1 * m2 * m3 + m2 * m3 * m4 + ...
int sum3 = 0 ; for ( int i = 0 ; i < k ; i ++ ) sum3 += count [ i ] * ( sum2 - temp [ i ] ) ; sum3 /= 3 ; return sum3 ; }