sum and length patterns