Find the sum of a sequence