Finding the first term and the number of terms in a given sum.