Finding the first term and sum of terms