find sum of all sub-squares - naive draft