flatten SUMSQ