Finding the sum of an arithmetic progression